make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.23k stars 490 forks source link

Tuya RGBCW lightbulbs unavailable after power-cycle #2322

Closed TheOriginalMrWolf closed 5 hours ago

TheOriginalMrWolf commented 5 hours ago

Hi,

Thanks for the great integration!

Having a small problem with lightbulbs though.

I have a bunch of Tuya RGBCW (Arlec branded) lightbulbs. When I turn them off at the wall switch (rather than in HA) they become 'unavailable' - which is normal - however after turning on again, only some (randomly) become available whilst others remain unavailable.

Within a few seconds of being turned on they are all immediately controllable via the Tuya app and they all respond to network pings to their respective hostnames, unfortunately only some become available again in HA (always seems to be a different combination).

If I reload the integration for an unavailable light it becomes available again within a few seconds. If I don't reload the integration it never becomes available again, even after many hours or days.

If I continuously power cycle the lights then different lights become available/unavailable. Sometimes, after many attempts, all become available again.

All lights are statically configured with protocol v3.3 (no other version works anyways) and with a hostname - eg: ESP_371353.lan (my DNS server assigns IP addresses and responds to name lookups with the correct IP address). Same behaviour regardless if lights have static or dynamic IP addresses.

Here is a diagnostic from a light that is working properly: tuya_local-9f390df79f743c2950296d9df2b985d6-Spare Room A's Desk-0efe845d6e4d518a37cd8d9e1994f163.json

And here is one from a light that became unavailable after powercycle: tuya_local-7c2a3754da07da55b92283fe787f3a55-Spare Room Wardrobe-00fa293513d931cbd78e5be7140f0420.json

Finally, one from debugging log - powered off lights, turned on debug, turned on lights. You can see how some come back but not others. tuya-debugging.log

I hope this makes sense & please let me know if there's anything further I can do to help debugging.

make-all commented 5 hours ago

If you are turning devices' power off, you have to expect that they will give you problems. They could leave hung connections behind, or get reassigned different IP addresses next time they are on.

TheOriginalMrWolf commented 5 hours ago

Hi @make-all - thanks for the rapid reply!

Re changing IP addresses - all of the lights have static IP addresses set so that won't be an issue.

Re 'hung connections' - one would expect that the application should be able to easily react to timeouts or RST connections and re-initiate a new connection & resynchronise. After all, reloading the integration deals with the scenario.

Cheers!