Since core-2021.5.0 when I restart HA, I need to manually go on my Local Tuya integration and reload all my switches one by one otherwise they will be unavailable.
Is it happening to someone else? Is there a way to, at least, load all local tuya integrations together?
Here the log:
2021-05-08 10:19:16 ERROR (MainThread) [custom_components.localtuya.common] [723...b60] Connect to 192.168.1.201 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 149, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
I get the error for just couple of tuya switches but not all of them despite all devices are unavailable after the reboot
I have the same problem, but for a long time now (not related to 2021.5.0).
So I created an automation, which triggers at HA start, waits a minute and checks, if any of Tuya devices are unavailable. If they are, It calls the “reload localtuya” service.
Not a very elegant solution, but it works :).
alias: _Tuya reload
description: ''
trigger:
- event: start
platform: homeassistant
condition: []
action:
- delay: '00:01:00'
- condition: or
conditions:
- condition: state
entity_id: switch.tuya1_local
state: unavailable
- condition: state
entity_id: switch.tuya2_local
state: unavailable
- condition: state
entity_id: switch.tuya3_local
state: unavailable
- service: localtuya.reload
data: {}
mode: single
Thank you! it’s working like a charm. I didn’t think about creating an automation probably because I didn’t know there is a service to reload local tuya
For some reason the workaround stopped working and I need to manually reload all switches again. I’m back to use the Tuya integration for now unfortunately
There must be something else going wrong with the Local Tuya integration on your install. I have 34 entities on 14 switches managed by Local Tuya. Out of ~5 HA-restarts max 1 or 2 switches fail to load and have to get manually reloaded.
I had a strange behaviour with my tuya devices. Suddenly the other day all of them stopped working from the app and I managed to get it back to work by changing the dns on my router configuration (it was using the provider one). But I thought “local tuya” means that I could use my device even when they’re not able to go on Internet but it doesn’t seem so.
What happens if you don’t allow your tuya devices to connect to Internet? Are they still working?