New Xiaomi gateway firmware (xiaomi_aqara component)

Ok, so it doesn’t seem related to the upgrade itself, which is good!

I will try to reset my GW tomorrow and I will let you know if it worked, thank you so much for your feedback! :slight_smile:

Try to remove your motion sensor from gateway and reboot it and Hass also.

I tried, even removing everything, the behaviour it’s still the same. :frowning:

2017-12-21 12:12:43 INFO (MainThread) [homeassistant.setup] Setting up xiaomi_aqara
2017-12-21 12:12:43 DEBUG (SyncWorker_5) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2017-12-21 12:12:43 INFO (SyncWorker_5) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2017-12-21 12:12:43 INFO (SyncWorker_5) [PyXiaomiGateway] Xiaomi Gateway 286c0785bfce found at IP 192.168.1.11
2017-12-21 12:12:43 INFO (SyncWorker_5) [PyXiaomiGateway] Discovering Xiaomi Devices
2017-12-21 12:12:43 DEBUG (SyncWorker_5) [PyXiaomiGateway] >> b’{“cmd” : “get_id_list”}’
2017-12-21 12:12:43 DEBUG (SyncWorker_5) [PyXiaomiGateway] << {‘cmd’: ‘get_id_list_ack’, ‘sid’: ‘286c0785bfce’, ‘token’: ‘xwfIOSUygEKJkJFL’, ‘data’: ‘[]’}
2017-12-21 12:12:43 INFO (SyncWorker_5) [PyXiaomiGateway] Found 1 devices
2017-12-21 12:12:43 DEBUG (SyncWorker_5) [PyXiaomiGateway] >> b’{“cmd”:“read”,“sid”:“286c0785bfce”}’
2017-12-21 12:12:43 DEBUG (SyncWorker_5) [PyXiaomiGateway] << {‘cmd’: ‘get_id_list_ack’, ‘sid’: ‘286c0785bfce’, ‘token’: ‘xwfIOSUygEKJkJFL’, ‘data’: ‘[]’}
2017-12-21 12:12:43 ERROR (SyncWorker_5) [PyXiaomiGateway] Non matching response. Expecting read_ack, but got get_id_list_ack

Definitely something wrong with gateway firmware. It’s not recognizing read command where he should report state of his sensors.

Exactly, the strange thing is that it’s working fine for other people. Which is good of course! :stuck_out_tongue: But doesn’t explain it.
I guess I will have to wait for the next update… Thanks for your support!

Have you tried to reset gateway by holding button?

Yes, I tried several times… For 5 seconds, for 10 seconds, several times in a row, no changes…

I just got into the same problem. Same firmware upgrade.

I have the xiaomi_aqara component configured, and I have previously run my config both on different flavors of Raspberry PI, on my previous install on my Nuc which was Debian. No problem.

But now I run it in Docker and I get this error when trying to send events to the Xiaomi Gateway (play ringtone, turn on light etc):

Error executing service <ServiceCall light.turn_on: entity_id=['light.gateway_light_34ce00fb510b']>
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/core.py", line 1010, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/usr/src/app/homeassistant/components/light/__init__.py", line 270, in async_handle_light_service
    yield from light.async_turn_on(**params)
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/light/xiaomi_aqara.py", line 98, in turn_on
    if self._write_to_hub(self._sid, **{self._data_key: rgbhex}):
  File "/usr/local/lib/python3.6/site-packages/xiaomi_gateway/__init__.py", line 288, in write_to_hub
    data['key'] = self._get_key()
  File "/usr/local/lib/python3.6/site-packages/xiaomi_gateway/__init__.py", line 337, in _get_key
    backend=default_backend()).encryptor()
  File "/usr/local/lib/python3.6/site-packages/cryptography/hazmat/backends/__init__.py", line 15, in default_backend
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/usr/local/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/usr/local/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 54, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "/usr/local/lib/python3.6/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /usr/local/lib/python3.6/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so: cannot change memory protections: Permission denied

It is the latest HA image and my host OS is alpine linux.
I am running the HA container in privileged mode with host networking, and Docker runs as root.

Anyone got an idea on what could be the problem?

EDIT: Reinstalled my Nuc with Debian Stretch as host instead. Added docker and published my images with same config as on Alpine. Everything worked right out of the box.

I really wanted to run Alpine as host, but it seems Debian is a better choice. For now, at least.

i am also having the same problem. can call the ringtone service. my firmware is 1.4.1_153. Appreciate if you can post when you get it fixed.

getting. “Non matching response. Expecting read_ack, but got get_id_list_ack”

Hi
Im successfully used xiaomi_aqara component with hassio and android-app. Updated firmware and app a few times and all works fine in hassio :slight_smile: Door-sensors, old-type button and motion sensors works very well.

But, the switches of the new type (square ones) just wont show up as sensors in my HA. They work fine in the app. I can do automations in the android app etc, but I have four buttons that still wont be discovered (not visible) in HA.

Have I missed some step? Anyone who can please help me in the right direction?

Best
/PH

Xiaomi buttons (square or round), do not appear on frontend by default. Why would you want it to appear?

Still then, these should be listed as entities like binary_sensor.switch_xxxxxxxxxxxx, but I’ve never tried to add it to the frontend.

Hi!
The other gadgets lists as entities (developer-states-list), but the square buttons dont show. :frowning:
Best
/PH

Hie,

did you get this fixed? if so then how? i am also having the same error in hass.io and i thought its becasue i updated to latest firmware on the xiaomi gateway.

@PHOLAUSSON @umerfraz Please enable the debug logging of the component and provide the log (home-assistant.log) of a home assistant startup.

# configuration.yaml

logger:
  default: warn
  logs:
    xiaomi_gateway: debug
    homeassistant.components.xiaomi_aqara: debug

This is the interesting part:

2018-03-24 09:02:38 DEBUG (Thread-21) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-03-24 09:02:38 INFO (Thread-21) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-03-24 09:02:38 INFO (Thread-21) [xiaomi_gateway] Xiaomi Gateway 286c0788b360 found at IP 192.168.130.29
2018-03-24 09:02:38 INFO (Thread-21) [xiaomi_gateway] Discovering Xiaomi Devices
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{"cmd" : "get_id_list"}'
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'sid': '286c0788b360', 'data': '["158d000119fd8c","158d000119fcc2","158d000128ac22"]', 'token': 'inxTQK2jr0IGkt9n', 'cmd': 'get_id_list_ack'}
2018-03-24 09:02:38 INFO (Thread-21) [xiaomi_gateway] Found 37 devices
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d000119fd8c"}'
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'sid': '158d000119fd8c', 'model': 'motion', 'data': '{"voltage":3025}', 'short_id': 56278, 'cmd': 'read_ack'}
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] Registering device 158d000119fd8c, motion as: binary_sensor
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d000119fcc2"}'
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'sid': '158d000119fcc2', 'model': 'magnet', 'data': '{"voltage":3005,"status":"open"}', 'short_id': 44778, 'cmd': 'read_ack'}
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] Registering device 158d000119fcc2, magnet as: binary_sensor
2018-03-24 09:02:38 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d000128ac22"}'
...
...
2018-03-24 09:02:44 INFO (Thread-21) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2018-03-24 09:02:44 INFO (Thread-21) [xiaomi_gateway] Creating Multicast Socket

Thank you for your interest in this :slight_smile:
Will this be of any help?

2018-03-24 10:39:20 DEBUG (SyncWorker_3) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-03-24 10:39:20 INFO (SyncWorker_3) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-03-24 10:39:20 INFO (SyncWorker_3) [xiaomi_gateway] Xiaomi Gateway 7811dc64e210 found at IP 192.168.86.113
2018-03-24 10:39:20 INFO (SyncWorker_3) [xiaomi_gateway] Discovering Xiaomi Devices
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd" : "get_id_list"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'get_id_list_ack', 'sid': '7811dc64e210', 'token': '6LESNLdcevV99RRD', 'data': '["158d00016c5451","158d0001240258","158d0001b12980","158d0001d84f5e","158d0001d8f1cc","158d0001bb4248","158d0001a98a5b","158d0001d54c5a"]'}
2018-03-24 10:39:20 INFO (SyncWorker_3) [xiaomi_gateway] Found 9 devices
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d00016c5451"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'sensor_switch.aq2', 'sid': '158d00016c5451', 'short_id': 36177, 'data': '{"voltage":3035}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d00016c5451, sensor_switch.aq2 as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001240258"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'sensor_switch.aq2', 'sid': '158d0001240258', 'short_id': 20453, 'data': '{"voltage":3600}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d0001240258, sensor_switch.aq2 as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001b12980"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'switch', 'sid': '158d0001b12980', 'short_id': 10825, 'data': '{"voltage":3032}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d0001b12980, switch as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001d84f5e"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'sensor_magnet.aq2', 'sid': '158d0001d84f5e', 'short_id': 61535, 'data': '{"voltage":3015,"status":"close"}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d0001d84f5e, sensor_magnet.aq2 as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001d8f1cc"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'smoke', 'sid': '158d0001d8f1cc', 'short_id': 48622, 'data': '{"voltage":3165,"alarm":"0"}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d0001d8f1cc, smoke as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001bb4248"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'magnet', 'sid': '158d0001bb4248', 'short_id': 6255, 'data': '{"voltage":3025,"status":"close"}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d0001bb4248, magnet as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001a98a5b"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"voltage":3035}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d0001a98a5b, motion as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"158d0001d54c5a"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d54c5a', 'short_id': 50010, 'data': '{"voltage":2995}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 158d0001d54c5a, motion as: binary_sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd >> b'{"cmd":"read","sid":"7811dc64e210"}'
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'gateway', 'sid': '7811dc64e210', 'short_id': 0, 'data': '{"rgb":0,"illumination":1292,"proto_version":"1.0.9"}'}
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 7811dc64e210, gateway as: sensor
2018-03-24 10:39:20 DEBUG (SyncWorker_3) [xiaomi_gateway] Registering device 7811dc64e210, gateway as: light
2018-03-24 10:39:25 INFO (SyncWorker_3) [xiaomi_gateway] Gateway discovery finished in 5 seconds
2018-03-24 10:39:25 INFO (SyncWorker_3) [xiaomi_gateway] Creating Multicast Socket
2018-03-24 10:39:25 DEBUG (SyncWorker_3) [homeassistant.components.xiaomi_aqara] Gateways discovered. Listening for broadcasts


2018-03-24 10:43:48 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"status":"motion"}'}
2018-03-24 10:43:48 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001a98a5b: off>: {'status': 'motion'}
2018-03-24 10:44:49 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"status":"motion"}'}
2018-03-24 10:44:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001a98a5b: on>: {'status': 'motion'}
2018-03-24 10:45:42 DEBUG (Thread-39) [xiaomi_gateway] MCAST (heartbeat) << {'cmd': 'heartbeat', 'model': 'motion', 'sid': '158d0001d54c5a', 'short_id': 50010, 'data': '{"voltage":2995}'}
2018-03-24 10:45:42 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001d54c5a: off>: {'voltage': 2995}
2018-03-24 10:46:49 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"no_motion":"120"}'}
2018-03-24 10:46:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001a98a5b: on>: {'no_motion': '120'}
2018-03-24 10:47:49 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"no_motion":"180"}'}
2018-03-24 10:47:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001a98a5b: off>: {'no_motion': '180'}
2018-03-24 10:48:56 ERROR (MainThread) [xknx.log] Error while processing telegram <CouldNotParseTelegram description="payload invalid" device_name="Illumination cyclical" group_address="0/3/32" payload="<DPTArray value="[0x80]" />"/>
2018-03-24 10:49:49 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"no_motion":"300"}'}
2018-03-24 10:49:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001a98a5b: off>: {'no_motion': '300'}
2018-03-24 10:54:48 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"no_motion":"600"}'}
2018-03-24 10:54:48 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001a98a5b: off>: {'no_motion': '600'}
2018-03-24 10:58:56 ERROR (MainThread) [xknx.log] Error while processing telegram <CouldNotParseTelegram description="payload invalid" device_name="Illumination cyclical" group_address="0/3/32" payload="<DPTArray value="[0x80]" />"/>
2018-03-24 11:02:46 DEBUG (Thread-39) [xiaomi_gateway] MCAST (heartbeat) << {'cmd': 'heartbeat', 'model': 'sensor_switch.aq2', 'sid': '158d00016c5451', 'short_id': 36177, 'data': '{"voltage":3035}'}
2018-03-24 11:02:46 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Switch_158d00016c5451: off>: {'voltage': 3035}
2018-03-24 11:04:47 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001a98a5b', 'short_id': 28904, 'data': '{"no_motion":"1200"}'}
2018-03-24 11:04:47 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001a98a5b: off>: {'no_motion': '1200'}
2018-03-24 11:06:09 DEBUG (Thread-39) [xiaomi_gateway] MCAST (heartbeat) << {'cmd': 'heartbeat', 'model': 'sensor_magnet.aq2', 'sid': '158d0001d84f5e', 'short_id': 61535, 'data': '{"voltage":3015,"status":"close"}'}
2018-03-24 11:06:09 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Door Window Sensor_158d0001d84f5e: off>: {'voltage': 3015, 'status': 'close'}
2018-03-24 11:06:31 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001d54c5a', 'short_id': 50010, 'data': '{"status":"motion"}'}
2018-03-24 11:06:31 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001d54c5a: off>: {'status': 'motion'}
2018-03-24 11:07:31 DEBUG (Thread-39) [xiaomi_gateway] MCAST (report) << {'cmd': 'report', 'model': 'motion', 'sid': '158d0001d54c5a', 'short_id': 50010, 'data': '{"status":"motion"}'}
2018-03-24 11:07:32 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001d54c5a: on>: {'status': 'motion'}

Please search for 158d00016c5451 and 158d0001240258 at http://your-hass-instance/dev-state. Are they listed as binary_sensor?

Yes, both listed and working.

If I thought there was a gateway-free solution that was stable and working in hassio, I would immediately buy one :slight_smile: The zigate seems promising, but immature and lots of problems reported. The conbee seems not to be working in hassio, and I´d like to keep hassio (running on Intel NUC). …

In this case I don’t understand your issue. Which device doesn’t work? It looks like everything is fine and running.