device IP: static lease for good practice? #1534
-
I'm just starting to migrate from local tuya to this (tuya-local). Noting that I need to enter the device IP during integration set-up, would the device run in to issues if my DHCP server hands out a new ip to the device? Or is that only used during set-up and dynamic IPs will be ok? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
It is better to set up a static IP (DHCP reservation) for your devices so they do not move around. You can use domain names in the address field, but there are some limitations with the way HA does DNS lookups and DNS cache timeouts etc that will make that less reliable than static IPs. There is also an option to use Auto discovery by leaving the IP address blank, but this violates HA design guidelines by sleeping on the event thread, and also will not work if localtuya is also installed, as it requires access to several broadcast listening ports that can only be opened by one integration. Even when the Auto setting does work, it makes connection take much longer, which also affects reconnection if your device goes offline for brief periods as Tuya devices often do. |
Beta Was this translation helpful? Give feedback.
-
Ah, that explains why the 'auto' detection didn't work for me. Would it be possible to configure by mac address so that it is happy with dynamic IP leases? |
Beta Was this translation helpful? Give feedback.
-
Interestingly, as a bit of a test, I set a static IP (different to what dynamic handed out) and made sure that the device was connected to the new IP, then also restarted HA. The device was functioning just fine despite the change of IP. I don't understand the behind the scenes working of it, or if I would experience problems later but it seemed to that changing IP didn't bother it. |
Beta Was this translation helpful? Give feedback.
It is better to set up a static IP (DHCP reservation) for your devices so they do not move around.
You can use domain names in the address field, but there are some limitations with the way HA does DNS lookups and DNS cache timeouts etc that will make that less reliable than static IPs.
There is also an option to use Auto discovery by leaving the IP address blank, but this violates HA design guidelines by sleeping on the event thread, and also will not work if localtuya is also installed, as it requires access to several broadcast listening ports that can only be opened by one integration. Even when the Auto setting does work, it makes connection take much longer, which also affects recon…