Question about IP discovery #2244
-
Hello, I've recently migrated from the local-tuya to the tuya-local project. Although, after a tuya device (in this instance, some kind of smart plug) loses power, the integration does not pick up on it again. When i looked into why the ip of the device changed, to my horror i found its mac address is randomised on each boot. How does tuya-local deal with these ip changes? (I can provide logs and such if needed, but this is more so a question of how ip discovery works. I don't know if this is expected behaviour or not) (Also weirdly, sometimes the device changes its ip back to what it was before, but not always) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Just a suggestion. Why Don't you set a static IP to the device. I've done this with all my Wifi Smart devices to guarantee no changes |
Beta Was this translation helpful? Give feedback.
-
IP discovery will not work if you still have localtuya installed, as the broadcast port is fixed so there can only be one listener on each IP address (the HA IP address here). To use IP discovery, you can enter "Auto" for the IP address, but that has a downside of making recovery take longer, and possibly failing due to localtuya presence. Static IP assignment in your router is a much more robust solution. Setting the protocol version explicitly will also help with recovery a lot, as it can take 5 minutes of timeouts and retries to cycle through just one attempt at reconnecting using all the protocols (and if the address is set to Auto, there are further delays as the library does IP discovery on every attempt). |
Beta Was this translation helpful? Give feedback.
I have a similar change in testing now, but it causes two unit test failures, so I need to investigate whether the unit test needs updating or the change has side effects before committing.