Xiaomi Motion Sensor Problems

I recently bought a xiaomi motion senor and it pairs perfectly with the mi control hub. The sensor shows up in home assistant, however, it does not update in home assistant. Weirdly enough, the sensor updates in the mi home app.

It appears that after triggering the motion sensor once, it could no longer be triggered for about 5 minutes.

Does anyone have a solution to this?

Thanks

The sensor does have a timeout of 2min…otherwise you will get too many signals and waste your battery.

you have to provide the correct key when configuring your gateway

https://www.home-assistant.io/components/xiaomi_aqara/

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - key: xxxxxxxxxxxxxxxx
1 Like

I am facing the exact problem since this morning, but last night everything worked perfectly (sensor events are picked up by HA, and I could use it to activate triggers).

This morning, the mi sensor events stopped flowing to HA. I looked at the HA logs, it doesn’t pick up the events it used to pick up yesterday. For example, the following was from yesterday when motion was detected and picked up by HA:

2018-08-20 20:23:21 INFO (MainThread) [homeassistant.core] Bus:Handling <Event motion[L]: entity_id=binary_sensor.motion_sensor_158d0001d90a65>

2018-08-20 20:23:21 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state binary_sensor.motion_sensor_158d0001d90a65=off; friendly_name=Motion Sensor_158d0001d90a65, device_class=motion, No motion since=0 @

I tried the following this afternoon:

  1. Unpair the sensor and pair with the gateway again
  2. Unpair gateway with wifi, and paired again
  3. Updated the wifi key on gateway (via app), and updated its config in HA config, restarted HA

I’m seeing the sensor appearing in HA, but HA is not picking up the sensor events.

Where else should I be looking?

I have resolved this problem by specifying the mac, key, and host (ip address) of the gateway in the HA configuration file. The sensor events were not picked up by HA because the Xiaomi Aqara module failed to initialise as it didn’t manage to discover the Gateway automatically.

Let me know if it solves your problem as well.

Yea I think you have to specify the mac address as well. It works for me now thanks

Guys, I’m having the same exact problem:
My hub and motion sensors work OK on the mi app.
They also appear in HA, but I see no updates of motion or anything (always shows “clear”) even though mi app does see them. There aren’t any errors or warnings in the log file as well.
This is my config:

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - mac: '7c:49:eb:1c:fa:e3'
      host: 10.100.102.21
      key: e45ee993a49f4a07

Am I doing anything wrong?

Looking at the component documentation I cant see quotes for mac adress.

Just tried the following:

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - key: e45ee993a49f4a07
      mac: 7c:49:eb:1c:fa:e3
      host: 10.100.102.21

Same result :frowning:

Ok, did you get the hub recently?

Yes, just got it yesterday from Aliexpress.

Ok, maybe someone can chime in on potiential differences regarding new and old or if there are different models where some are not compatible.

My model is lumi.gateway.v3, I made sure that people got it to work with HA before buying it. Didn’t imagine it would be that hard.

I run it like the docs, without mac and it works fine. Ie

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - key: xxxxxxxxxxxxxxxx

Checked mi home app and only thing where one find token is that wireles communication protocol is enabled also.

When you got the token you switched on wireless communication protocoll ie LAN access?

If so the following in your config.yml and restart and it should work. Restart your xiaomi gateway as well.

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - key: e45ee993a49f4a07

your mac address needs to be formatted without “:”

It’s not entirely obvious from the docs but if you count the number of x’s you’ll see it

Guys, thanks a lot, but I can’t figure it out. I tried all your suggestions. Tried the following:

  • Restart xiaomi aqara gateway
  • Re-generate the LAN key from both iOS and Android
  • And all the above…

Basically, I can see the gateway in HA (and all sensors connected to it), but it doesn’t do anything. I see the gateway light switch, but can’t activate it (it just turns off by itself).
Also: I keep getting “invalid key” in the log file, can’t figure out why, I switched the key multiple times and it doesn’t help.

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - key: f65f404359264841
      mac: 7c:49:eb:1c:fa:e3
      host: 10.100.102.5

My Xiaomi configuration is made this way:

xiaomi_aqara:
  discovery_retry: 10
  gateways:
    - mac: '78:11:dc:xx:xx:xx'
      key: 0ztqkae8rqxxxxxxx
      host: 192.168.1.6

I had issues with invalid key also, now everything is working fine but the connection with the gateway is sometimes long and generate errors

@MrDje @Felix_Kreuk

Did you find a solution?

Yes, sadly my problem was the lack of multicast support on the part of my router. After getting a new router the problem went away.