Yesterday, I tried creating an automation for my kitchen lights. However, the Xiaomi Mi Motion sensor that I’m planning to use to trigger this automation does not update. I have multiple of these sensors, and all of them are working, except this one. I have paired these sensors through the Xiaomi Aqara hub, by inlcuding the following in configuration.yaml:
xiaomi_aqara:
discovery_retry: 5
gateways:
- key: !secret xiaomi_key
In the app, I do see that the motion sensor sees updates, just like the other sensors. However, these updates are somehow not communicated to Home Assistant. I set up the logger component, and I see these lines in the logs:
2019-07-16 12:57:31 DEBUG (Thread-3) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001d47c6f', 'short_id': 55144, 'data': '{"status":"motion"}'}
2019-07-16 12:57:31 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001d47c6f: off>: {'status': 'motion'}
However, this device ID is not available in home assistant. The sensor that is reported here is binary_sensor.motion_sensor_158d000187537d. This device is also discovered according to the logs:
2019-07-16 12:49:40 DEBUG (SyncWorker_0) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d000187537d"}'
2019-07-16 12:49:40 DEBUG (SyncWorker_0) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'motion', 'sid': '158d000187537d', 'short_id': 25098, 'data': '{"voltage":3015}'}
2019-07-16 12:49:40 DEBUG (SyncWorker_0) [xiaomi_gateway] Registering device 158d000187537d, motion as: binary_sensor
However, this is not a sensor that exists in the xiaomi app as far as I know. Moreover, the device that does show updates, is also discovered, but does not show up in my Home Assistant interface.
2019-07-16 12:49:40 DEBUG (SyncWorker_0) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001d47c6f"}'
2019-07-16 12:49:40 INFO (SyncWorker_6) [homeassistant.loader] Loaded google_translate from homeassistant.components.google_translate
2019-07-16 12:49:40 DEBUG (SyncWorker_0) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d47c6f', 'short_id': 55144, 'data': '{"voltage":3005}'}
2019-07-16 12:49:40 DEBUG (SyncWorker_0) [xiaomi_gateway] Registering device 158d0001d47c6f, motion as: binary_sensor
So to me it seems that the sensor is being discovered, but it is linked to the incorrect entity in Home Assistant.
However, I don’t know how to fix this. Can any of you help me with this problem? Thanks!