fishbigger/HomeAssistant-Tapo-P100-Control

No reconnect after connection lost for lights

wlp7s0 opened this issue · 2 comments

Hello,
I've been experimenting with L530E and discovered that if I turn off the bulb and turn it on again after some time, I need to restart HA to be able to control it. So, after power outage or connection loss, HA is not able to connect to the bulb (my HA instance is not at the same location)

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fdd65a50b20>: Failed to establish a new connection: [Errno 110] Operation timed out

after this message, the light.py script does no attempts to reestablish the connection and log HA logs just spams
WARNING (MainThread) [homeassistant.components.light] Updating tapo_p100_control light took longer than the scheduled update interval 0:00:30
every 30 seconds. I've checked with tcpdump, no packages are send after connection broke.

To fix this, I've added
p100 = PyP100.P100(192.168.2.xxx, xxx@mail, pass)
as a first line in update function.
Unfortunately, I don't have a lot of python programming experience and HA integration, I'm sure there is a way to make it more elegant with config parsing.

Also, checked the same conditions with plugs. Strangely no issue with plugs.

Closing the issue. Not related to this integration.
https://github.com/fishbigger/TapoP100/issues/24