Xiaomi Aqara Devices Frequently Unavailable

PS - same problem happening on a Pi 3B+. Strongly considering moving to OpenHAB :frowning:

Why this IP?

That was Home Assistant’s eth0 IP on the network. The thought was that maybe it’s not listening on the right interface.

I tried OpenHAB, similar issues. Decided Home Assistant was much more straight forward to set up with Aqara.

Bought a Pi3 B+ in case it was something software related, same issues.

Then I brought the whole setup to my work office, to test on the corporate network and suddenly everything was working perfectly!

The problem was my router. It’s a ZTE ZXHN H298N as supplied by Hyperoptic ISP in the UK.
The router was either filtering out or just ignoring the status messages from the Xiaomi Gateway.

I replaced it with a TP-Link AC1750 Archer C7 (no reason other than same day Amazon delivery :slight_smile:) and it worked solid out of the box. Console now full of Xiaomi sensor status updates and no authentication issues.

I’m very happy. (well, not happy I had to buy a new router!)

1 Like

Good to know that you’ve found solution. I’ve tried something else, and… success :smiley:
I’ve made a copy of configuration.yaml, automation.yaml, secrets.yaml, and then I’ve made a clean install of hassio.
Then I’ve copied the files to clean installation, and to my surprise everything started working just fine.
I think that something has done some damage to the database or something (I don’t know hassio so well), and it was well hidden.

I decided to not install many add-on’s - I have a feeling that everything started working bad after DuckDNS addon installation, but that’s just a feeling.

Anyway, so far so good.

I’m having the same issues as others:

HA 80.2.
Mi Home updated 5.4.26
Mi Control Hub firmware updated 1.4.1_159.0143
hub plugin version 2.65.9

On my 2.4GHz wifi, signal strength reporting at 69% RSSI -47

I can control all of my devices inside of the Mi Home app.

The devices all show up and work in HA after I reboot HA, but then they all say “unavailable” at the exact same time.

Config:

xiaomi_aqara:
 discovery_retry: 10
gateways:
- mac: 34*******F
  key: t5*******0c
  host: 192.168.1.***

The history looks like this:

I’ve also got debug logs turned on for this component: Found here

I run HA on a rpi2 with docker. It’s behind a traefik reverse proxy. I’ve also got my wifi network setup in WAN bypass. My wifi is done by a Archer C2 router, the rpi has a static IP. I understand that in the documentation it says that Multicast must be enabled, I imagine the issues this component has is related to that, but the question I have is:

Why does this component work following a restart, and then at some later stage, complete stop working until I restart HASS again?

Some sort of multicast timeout. The MI App and xioami gateway are on the same wifi gateway so always work . when HA loses contact with gateway is it a random time when it disconnects ?

see

This is the cause. I can’t use net=host because I am using traefik.

I have 10 Xiaomi devices and all was well until I upgrade HA to version 0.82.0. Now some devices get unavailable (it seems at random times), but then after a while they get available again!!!

When was the last time the PyXiaomiGateway lib was updated in HA? Anyone know? There was at least one fix done in September of this year that might help folks

https://github.com/Danielhiversen/PyXiaomiGateway/issues/45

I’m having a similar issue as the others on HA 0.82.0b3. I’m having such errors:

  • Cannot connect to Gateway
  • No data in response from hub None

This started to happen since 0.82 version. Token is correct - double checked. Additionally, some more Xiaomi devices started to disconnect like power strips or Air purifier 2. It works again when it’s powered off and on.

Find out what channel your 2.4g wifi is using.
Then find the zigbee channel your gateway is using

Then look here to see if they are over lapping

try and move your 2.4g wifi channel as far away as possible from the zigbee channel as described in the above article… i did this and rarely get unavailable sensors etc

1 Like

Hi guys,

I had this issue and tried everything! The thing that solved it was a replacement router.
I found this after bringing my hass pi3, Xiaomi Gateway and a motion sensor to work, set them up in the morning on the work WiFi and seeing no dropouts after the whole day.

I was using an ISP supplied ZTE ZXHN H298N, which it turns out was either ignoring or filtering out the multicast heartbeat messages coming from the Xiaomi Gateway.
Got a TP-Link AC1750 Archer C7 and it all started working out of the box. No dropouts since (been 4 weeks now).
So, try taking a bare bones setup to another network to see how it performs. Worth a try!

Had the same issues on 0.82. On 0.80 everything was working fine.

Changed my config from:

xiaomi_aqara:
  gateways:
    - key: !secret xiaomi_key

to:

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - key: !secret xiaomi_key
      mac: 11:5c:77:98:17:b2

and so far it seems to be working again :crossed_fingers:
The mac above is a random one and not my actual mac :wink:

Hey,
Is it still working without issues?

Hi,

In my case yes.

need to remove the colons - these are not supported here:

(string)(Optional)The MAC address of your gateway. Needs to be formatted without “:”. Optional if only using one gateway.

Yep still working without issues.

You’re right, that part probably doesn’t do anything in my config :confused:

Is it still working for you?

Mine seemed to work fine, but it’s showing as unavailable more frequently lately…

Yep it’s still working here.

same here, unavailable problems… Do you have the same status (offline) in Mi home?