al-one/hass-miio-yeelink

Error: Failed to connect the device

bogorad opened this issue · 5 comments

I moved a MI device (yeelink.light.color1) to a different subnet (HA is in 192.168.11.0/24, the device is now in 192.168.40.0/24). I can ping the device both from the HA host, and from the HA container:

$ docker exec home-assistant ping 192.168.40.71
PING 192.168.40.71 (192.168.40.71): 56 data bytes
64 bytes from 192.168.40.71: seq=0 ttl=254 time=8.176 ms
64 bytes from 192.168.40.71: seq=1 ttl=254 time=40.925 ms
64 bytes from 192.168.40.71: seq=2 ttl=254 time=20.183 ms

But when I try to add the device, I get the dreaded 'failed to connect' error. The token is correct, I used the same method (the app) when I connected the device to the original network.

Any ideas why? The official Xiaomi integration fails as well - so I'm thinking maybe Xiaomi wants the devices to be in the same subnet? That would suck.

P.S. The MI home app (modified) sees and operates the device without any issues, even from a different subnet.

I can see it pinging the device (successfully) and sending some UDP data there, but nothing in return

image

Packets sent from the app arrive just fine:

image

Connected back to the same subnet as HA - works just fine. Can this be fixed?

izacus commented

No, this is a known property of Yeelights and some other Xiaomi IoT firmware: for security they won't talk to devices on another subnet. So you'll either need to configure your router to do NAT to the IoT subnet or connect your HASS device to both subnets.

Thank you, that's what I figured. Set up avahi-daemon to retransmit mDNS and it was fixed immediately.