I have it mostly working with 3 tap timers and a moisture sensor. You’re a bloody legend, Darek!
However, I’m getting heartbeat timeout errors, typically on one device of the three. This is not a particular device getting the error consistently, but there is always one or two that get it. Each time I reboot HASS or reload localtuya, device 032 might timeout and 033 might be back online or vice versa. Device 031 (the first one I installed) seems to be the most consistent at connecting, but this could be a fluke.
2021-11-20 18:26:26 DEBUG (MainThread) [custom_components.localtuya.pytuya] [033...033] Heartbeat failed due to timeout, disconnecting
' THE ABOVE ERROR MESSAGE IS FROM LINE 387 OF ./pytuya/__init__.py
2021-11-20 18:26:26 ERROR (MainThread) [custom_components.localtuya.common] [033...033] Connect to 192.168.1.191 failed
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/localtuya/common.py", line 149, in _make_connection
status = await self._interface.status()
File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/__init__.py", line 472, in status
status = await self.exchange(STATUS)
File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
I’ve tried increasing HEARTBEAT_INTERVAL
as high as 120 in ./pytuya/__init__.py
(line 77) but I still get the error. (in fact, 120 seems to make it less stable, where they all lose connection sporadically)
If I open the Smart Life app on my phone, they all disconnect from HA, but come back when I close it.
It looks like the _make_connection function is asynchronous. I wonder if it would work better if the holman devices were polled sequentially (synchronously)? e.g. maybe the holman hub is choking on asynchronous requests for multiple devices.
Any ideas?
Thanks,
Joe