Platform tuya_local does not generate unique IDs
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
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.
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:
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
just an update the device is working again after I have restarted HA. So it's HA to blame?
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.
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.
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.
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.
Original issue has not been observed for 1 month+ so closing the issue for now and will reopen if needed.
I am having this problem now, maybe reopen this issue?
I have 95 of these errors. Also after some time I get this:
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:
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...
Platform tuya is not my responsibility.