Update IP address in Tuya Local when device goes unavailable because IP changed #2354
Replies: 3 comments 6 replies
-
yeah I found myself in the same scenario and had quite a hard time but managed to fix it. 💪 I was about to ditch the whole integration as it was becoming unmaintainable, until I decided to dig into the code and try to find way around it. My idea was to pass it the device MAC address and gather the IP automatically using ARP requests until I realized it was a lot easier than that! The documentation says you need to have the device's IP address, turns out you don't! If it fails, simply power cycle the device and try again. |
Beta Was this translation helpful? Give feedback.
-
Note that the Auto IP address setting brings its own problems, which is why the instructions no longer advertise it. Mainly slow reconnection after network failures, but in some cases the devices never seem to recover until a HA restart. Using static IP addresses or assigning DNS names to your devices is still a better option unless that absolutely is not possible with your router. |
Beta Was this translation helpful? Give feedback.
-
I have the same issue as the OP. My device IP changed (I've now fixed this to a new static address). And although it seems like you can type a new IP for the device, this doesn't work - it gives the same error the OP mentioned. Disabling the device and creating a new one was the only way I could do it. I assume it must be a bug where the IP doesn't update. I don't really even need it to validate. If it could just update the config to the new IP, I'm pretty sure that would work. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm hoping someone can help me with updating the IP address of a device in Tuya Local without deleting the device completely and re-adding it.
I have the latest version of HA Core (2024.9.3) and Tuya Local integration (2024.9.1).
I have around 30 wall switches (Tuya/Brilliant Smart Elite Glass switches 1-4 gang). Every now and then a switch will go unavailable. They were added to Tuya Local using the Smart Life app QR code and their IP's are assigned using DHCP (router doesn't support reservations :() and so the IP changes every now and then. I have tried updating the IP in the Tuya Local integration > Configure menu for the problem switch and entering the new IP address however I just get the error "Unable to connect to your device with those details. It could be an intermittent issue, or they may be incorrect." or from the debug log "Retrying after exception <class 'AttributeError'> Network Error: Unable to Connect (2/3)". I have left it for several days and tried again and still no luck.
I can't for the life of me get the switch out of this state without deleting and re-adding the device which is a pain because I have a lot of automations that need updating.
The device is still available/functional in the Smart Life app, and I can get the device details from the Tuya iot dev portal (and new device IP from my router). I am not using any other Tuya addons/integrations that would conflict.
I can ping the device on its new IP address and I can control the device with tinytuya from within the Home Assistant core container by doing the following (also works using powershell/python from my laptop). I believe I've ruled out a network issue or device id/key/version issue by doing this. I only tried this to troubleshoot after it didn't work via the integration.
docker exec -it homeassistant bash
python
import tinytuya
d = tinytuya.Device(dev_id='37138xxxxxxxxxxx9943ba', address='192.168.x.x', local_key="|-05xxxxxxxxo1g", version=3.1)
d.status()
d.turn_on()
d.turn_off()
I would have thought entering the new IP address in the Tuya Local > Configuration section for the switch would trigger a similar workflow to the above, but it just doesn't seem to work. Is this not supported, or is there any other way of updating the IP without deleting/readding the device?
I have searched the discussions and issues and read the last 10-15 or so posts including #522 which has a bunch of links for possible similar issues to what others have encountered however none of them really mention a solution for updating/changing the IP address of a device. This topic is somewhat similar however I am not referring to auto scanning but manually changing the IP: #2244
Any help would be greatly appreciated. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions