Well, unfortunately the log stops after the line: 2018-04-12 11:52:10 DEBUG (Thread-5) [homeassistant.components.xiaomi_aqara] Gateways discovered. Listening for broadcasts
So, I got no more error when it becomes unavailable. What I seen is that the Gateway will becomes unavailable exactly after 2,5 hours
Btw, about the config, if I specify only this:
xiaomi_aqara:
discovery_retry: 10
gateways:
- key: xxxxxxxxxxxxxxxxxx
The HA is not able to discover the Gateway and the Log will show me the error 2018-04-12 17:21:04 INFO (Thread-8) [xiaomi_gateway] Gateway discovery finished in 5 seconds
_ 2018-04-12 17:21:04 ERROR (Thread-8) [homeassistant.components.xiaomi_aqara] No gateway discovered_
Sure, I have MAC address reservation and during unavailability I can ping the gateway from raspberry. Btw, I installed this: https://github.com/Danielhiversen/PyXiaomiGateway and seems now is much more stable.
I’m experiencing the exact same problem after uppgrading hassbian from 0.62.0 to 0.67.1. Before it ran for weeks without needing restart, now xiaomi stops working after exactly 2.5 hours. After a restart of hass, it works again right away, for the exact same time again. I’ve tried copying all xiaomi files from another installation that’s still on 0.62.0, but not sure if I did it correctly, it didn’t make a difference anyway. Any tips of what to try is greatly appreciated.
I have exactly the same issue with a fresh install of Hassbian on RPi3 (HA 0.68.0, upgraded to 0.68.1 yesterday). Everything works after a reboot of HA, then after some time all sensors stop working with HA (but OK in Mi Home), and then everything works again by itself after some minutes or hours, or if I manually restart HA. I have absolutely no logs during the time where it stops working (I enabled xiaomi debug logs).
Anyone else? Is there any issue submited about that?
Guys, I discovered the root cause for my issue. I have a Firewall hardware with Endian Firewall software for my whole home lan/wifi. From firewall logs I seen that it drops every broadcast packets coming from/to the Gateway. Broadcast messages is used by Gateway to discover its sensors, without these, it just go in timeout after 2,5 hours.
So I adjusted this behaviour and now only the broadcast packets sent to firewall is dropped, and the gateway never becomes unavailable again.
My advice is to check your router/modem/firewall and so on to leave wi-fi devices communicate each others without limitation.
I don’t think it uses wifi broadcast messages to discover sensors, they use zigbee not wifi afaik.
I upgraded to 0.68.1, removed the host entry under xiaomi, performed a little dance and it started working. Not sure which of these solved it, or if it was a combination. What I did not do was fiddle with my firewall, but the rpi with hassbian and the xiaomi gateway are on the same lan, so fw should not be an issue. Your mileage may vary.
I think I experience the same problem with the gateway, it becomes unavailable after some hours and even changing it to a fixed IP and changing that in the configuration.yaml doesn’t have any effect.
Also the same as some people here I was using the Xiaomi gateway with my previous hass.io installation for months without any problem, now it’s stable for only 2 hours … Also without xiaomi host set to the IP it will not discover the gateway and only log “No gateway discovered”.
I have the same issue. Fresh install of HA (awesome work by the way !) on a Pi 3 via Docker. I had some difficulties to get the Gateway Discovered, but with the IP and the Mac address set it finally worked.
After 2.5 hours my captors get vanished, If I restart HA again all is back to the normal but then 2.5 hours after same issue.
Connected the gateway without any problems. But after 150 mins it stops working and initially after boot it seems to not update my sensors aswell.
If read something about adding --net=host to the docker instance because it might have something to do with multicast, but both of them, i don’t know how to check or to configure.
I am using hass.io from the image, so i didn’t install it myself on any linux distro, nor did it configure it in docker myself.
Same issue here since updating from .72 to .78. I have blocked the Xiaomi gateway’s internet (parental control style) on my router since the beginning, but I haven’t changed it.
Hi @sjee, thank you for your answer. I don’t have any firewall set. I am a bit sceptical about this because It seems we all are experimenting the same behavior : the gateway get vanished after 2.5 hours and but still available via Mi Home, and If we restart HA all is ok again for 2.5 hours
I’m from France and my router is provided by my ISP (Freebox) and I doubt the other guys have the same Network Gear. I will try to dig a bit further this week-end …
@alexjomin not all… I’m not having any issues and @Lucas_Rey was able to solve the exact same issue. There are several (long) topics on network issues related to the Xiaomi gateway. As far as I know the way HA communicates with the gateway is different from the Mi home app. From that point of view there are some limitations in the API. The solutions I have seen where always related to the network configuration (router, wifi repeater, firewall, etc.) Others replaced the xiaomi gateway with a different zigbee gateway solution.
@sjee Maybe it’s a networking issue, but if so, the 2.5 hours timeout limit should be hardcoded somewhere in HA. I will try with another router and I’ll let you know.