fishbigger / HomeAssistant-Tapo-P100-Control

A custom integration for home assistant to control the Tapo P100 plugs
MIT License
207 stars 69 forks source link

Don't need to login and handshake every time? #12

Open arrival-spring opened 3 years ago

arrival-spring commented 3 years ago

I don't know how long the cookies last, but certainly we don't need to do the handshake and login every time the bulb is turned on or off or the brightness is set.

I've commented out those lines for now in the turn_on function and it means I get much quicker response times (sub half second, rather than a second or two).

They are still called (and so the cookie is refreshed) in the setup_platform, init and update functions, but I'm not sure how often those happen.

fishbigger commented 3 years ago

Yes I know that it doesn't need to login every time but through ha I can't see any way to only do it every set amount of time and I don't think anyone knows how long the cookies last for.

arrival-spring commented 3 years ago

Hmm, well I'll leave those bits commented out and see how long it is before it breaks.

fishbigger commented 3 years ago

That would be a good test :) On another thought update has to be called quite often to update the state of the bulb/plug when its changed outside of the app so leaving it in update should be fine.

Nerd0o0 commented 2 years ago

It took 5 days after restarting HA and a handshake was required as the switch stopped responding. Had to reboot again to login