tuya-local icon indicating copy to clipboard operation
tuya-local copied to clipboard

Platform tuya_local does not generate unique IDs

Open robinhood-code opened this issue 2 years ago • 4 comments

This form is for reporting bugs. If you have encountered a bug, you should generally have some log messages or device diagnostics to show something is going wrong. If your problem is more of a question or a request for help, then Discussions is probably a more suitable venue.

Describe the bug I'm using DHCP for some of my devices but I have entered the IP manually in Tuya Local configuration because the Auto wasn't too reliable. Recently the DHCP has changed the IP and therefore I updated the config after the device became unavailable. After clicking "submit" in the config screen the setting can be saved successfully, but the device is still unavailable. Upon checking the log I saw the follow error message:

Logger: homeassistant.components.light
Source: helpers/entity_platform.py:636
Integration: Light ([documentation](https://www.home-assistant.io/integrations/light), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+light%22))
First occurred: 5:51:17 PM (2 occurrences)
Last logged: 6:19:42 PM

Platform tuya_local does not generate unique IDs. ID bf9939a01bb0b5c3aekw3q-light already exists - ignoring light.guest_toilet_mirror

To Reproduce Steps to reproduce the behavior including the device the issue was observed with:

Update device IP in the device config screen.

Additional context

image image

robinhood-code avatar Feb 25 '24 07:02 robinhood-code

There may be a timing issue in bringing up the device with the new config. I'll see if there is any way to wait for the device to stop completely before starting again, as that should both avoid the log message and let the device connection succeed immediately after the setup with new config.

make-all avatar Feb 25 '24 07:02 make-all

So it has now been > 30 mins since I've updated the config. The device is still unavailable, and there is a new error log in HA:

image
Logger: homeassistant.helpers.service
Source: helpers/service.py:250
First occurred: 6:33:53 PM (2 occurrences)
Last logged: 6:36:43 PM

Referenced entities light.guest_toilet_mirror are missing or not currently available

robinhood-code avatar Feb 25 '24 08:02 robinhood-code

just an update the device is working again after I have restarted HA. So it's HA to blame?

robinhood-code avatar Feb 26 '24 23:02 robinhood-code

I haven't investigated yet. Probably there is something the integration can do, but it seems that for a "local push" integration, Home Assistant is expecting the integration to handle any startup failures and does not retry initialisation if it fails. "local polled" and "cloud polled", maybe "cloud push" integrations may be handled differently at the Home Assistant level, giving them more opportunity for recovery.

make-all avatar Feb 27 '24 01:02 make-all

Just an update. While I haven't encountered anymore "Platform tuya_local does not generate unique IDs" or "Referenced entities light.guest_toilet_mirror are missing or not currently available" errors since 2024.3.1 and the past 2 weeks. My Tuya Local still have difficulties in connecting to some of my Tuya devices after wifi outage / disconnection / router restart, while these devices are working fine with the offical Tuya mobile app. (and yes, I did force close the Tuya mobile app each time I have checked the device status to make sure no other active Tuya connection)

I can see from the log Tuya Local keeps trying to connect to those devices, but it keeps failing with the error: "DEVICE NAME error 901: Network Error: Unable to Connect". I still have to restart HA the get the devices reconnected again.

robinhood-code avatar Mar 11 '24 00:03 robinhood-code

I guess these devices are single local connection devices (lightbulbs and sometimes sockets are typically single connection, others typically allow 3 local connections before refusing), and somehow the original connection from before the WiFi outage is still there even though it is not working (or HA has discarded it to open a new one, but the device is still seeing it as open until HA restarting causes a lower level reset of the network stack).

How long have you waited? It is quite common for low level socket connections to time out after 5 minutes when they are in a hung state due to network disconnections.

make-all avatar Mar 11 '24 13:03 make-all

I have waited almost a day. I think you are right, Apparently that light switch (with dimmer control) refused any incoming connection (while outgoing connection is still working as the offical app still worked) and won't timeout itself. In the end I had to kill the power, waited for a few minutes and turned the power back on and then TL could connect it again.

robinhood-code avatar Mar 12 '24 01:03 robinhood-code

Original issue has not been observed for 1 month+ so closing the issue for now and will reopen if needed.

robinhood-code avatar Apr 28 '24 01:04 robinhood-code

I am having this problem now, maybe reopen this issue? image I have 95 of these errors. Also after some time I get this:

image

geedsen avatar Aug 17 '24 18:08 geedsen

I removed the tuya local devices. But the problem is still there. So that is not the problem. Searching for duplicate device id's in all files I found devices of smartlife. Last week before installting Tuya Local I tried smartlife as well. But that was not giving me any additional entities on the Tuya devices I needed. So I removed the integration. However it looks like it did not remove everything: image I wonder if that is part of the problem. I tried removing them from the file while HA is running. But after reboot those entities are still there in the config...

geedsen avatar Aug 17 '24 19:08 geedsen

Platform tuya is not my responsibility.

make-all avatar Aug 18 '24 08:08 make-all