Xiaomi door and smoke sensors are not updating

Hi,

I have problems with integrating a Xiaomi door and smoke sensors in HA. In the configuration.yaml the following lines are added:

xiaomi_aqara:
    discovery_retry: 10
    interface: '192.168.13.51'
    gateways:
      - mac: 7811DCB7D5aa
        key: 2bv7a2q8rjrjkpaa
        host: 192.168.249.104

After restarting the gateway and door and smoke sensors are displayed in the GUI. When i close a door the status is changed once. After that no status changes are updated anymore. In the log the following information is found:

Log
2018-06-01 21:33:09 DEBUG (SyncWorker_4) [homeassistant.components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling
2018-06-01 21:33:09 DEBUG (SyncWorker_4) [xiaomi_gateway] _send_cmd >> b’{ “cmd”:“read”,“sid”:“158d0001f26c40”}’
2018-06-01 21:33:09 DEBUG (SyncWorker_4) [xiaomi_gateway] _send_cmd resp << {‘cmd’: ‘read_ack’, ‘model’: ‘magnet’, ‘sid’: ‘158d0001f26c40’, ‘short_id’: 22658, ‘data’: ‘{“voltage”:3035,“status”:“close”}’}
2018-06-01 21:33:09 DEBUG (SyncWorker_4) [xiaomi_gateway] read_ack << {‘cmd’: ‘read_ack’, ‘model’: ‘magnet’, ‘sid’: ‘158d0001f26c40’, ‘short_id’: 22658, ‘data’: ‘{“voltage”:3035,“status”:“close”}’}
2018-06-01 21:33:09 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> : {‘voltage’: 3035, ‘status’: ‘close’}
2018-06-01 21:33:09 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.door_window_sensor_158d0001f26c40, old_state=<state binary_sensor.door_window_sensor_158d0001f26c40=on; Open since=0, battery_level=47.0, friendly_name=Door Window Sensor_158d0001f26c40, device_class=opening @ 2018-06-01T21:32:08.327587+02:00>, new_state=<state binary_sensor.door_window_sensor_158d0001f26c40=off; Open since=0, battery_level=47.0, friendly_name=Door Window Sensor_158d0001f26c40, device_class=opening @ 2018-06-01T21:33:09.353487+02:00>>
2018-06-01 21:33:09 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 140336462626376: Sending {‘id’: 2, ‘type’: ‘event’, ‘event’: {‘event_type’: ‘state_changed’, ‘data’: {‘entity_id’: ‘binary_sensor.door_window_sensor_158d0001f26c40’, ‘old_state’: <state binary_sensor.door_window_sensor_158d0001f26c40=on; Open since=0, battery_level=47.0, friendly_name=Door Window Sensor_158d0001f26c40, device_class=opening @ 2018-06-01T21:32:08.327587+02:00>, ‘new_state’: <state binary_sensor.door_window_sensor_158d0001f26c40=off; Open since=0, battery_level=47.0, friendly_name=Door Window Sensor_158d0001f26c40, device_class=opening @ 2018-06-01T21:33:09.353487+02:00>}, ‘origin’: ‘LOCAL’, ‘time_fired’: datetime.datetime(2018, 6, 1, 19, 33, 9, 353503, tzinfo=)}}
2018-06-01 21:33:09 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 140336211365448: Sending {‘id’: 2, ‘type’: ‘event’, ‘event’: {‘event_type’: ‘state_changed’, ‘data’: {‘entity_id’: ‘binary_sensor.door_window_sensor_158d0001f26c40’, ‘old_state’: <state binary_sensor.door_window_sensor_158d0001f26c40=on; Open since=0, battery_level=47.0, friendly_name=Door Window Sensor_158d0001f26c40, device_class=opening @ 2018-06-01T21:32:08.327587+02:00>, ‘new_state’: <state binary_sensor.door_window_sensor_158d0001f26c40=off; Open since=0, battery_level=47.0, friendly_name=Door Window Sensor_158d0001f26c40, device_class=opening @ 2018-06-01T21:33:09.353487+02:00>}, ‘origin’: ‘LOCAL’, ‘time_fired’: datetime.datetime(2018, 6, 1, 19, 33, 9, 353503, tzinfo=)}}

So the problem is that is sees the sensors and when a status changes it only works once. After that it stops. No status changes are reported anymore.

What i already tried:

  • For HA i tried the Hassio image on a PI and Ubuntu with docker configured as Virtual Machine in VMware with the same results.
  • I use the latest firmwares with the Xiaomi sensors
  • Generate new keys with IOS and Android
  • I’m running the latest build of Home Assistant
  • I reset my Ubiquiti EdgeRouter Lite to factory defaults

Anyone has suggestions how to solve this problem?

Your YAML is not right, you have no indentation. Probably because you forgot to use the </> button to format it :slight_smile:

I changed the formatting of the yaml. I forgot to use the formatting tools in this post.

As you have one gateway did you try a basic config?

xiaomi_aqara:
  gateways:
    - key: xxxxxxxxxxxxxxxx

The basic config does not work. I need to specify the whole config.

Are you sure, because it still doesn’t work :wink: Check your network and Wifi config, are you using vLan?

Yes i’m using VLANs.

hello ief
I have encountered the same problem as you, how do you solve it?
think you!