let me activate debug and see what is happening behind the scene… thanks syssi…
I’ve enabled the debug output of the component and underlying library by:
# configuration.yaml
logger:
default: warn
logs:
xiaomi_gateway: debug
homeassistant.components.xiaomi_aqara: debug
custom_components.xiaomi_aqara: debug
custom_components.binary_sensor.xiaomi_aqara: debug
This is the log (with scan interval = 5secs):
2019-01-05 16:38:59 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"lux":"8"}', 'cmd': 'report', 'model': 'sensor_motion.aq2'}
2019-01-05 16:38:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 72.0>: {'lux': '8'}
2019-01-05 16:38:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: off>: {'lux': '8'}
2019-01-05 16:38:59 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"status":"motion"}', 'cmd': 'report', 'model': 'sensor_motion.aq2'}
2019-01-05 16:38:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'status': 'motion'}
2019-01-05 16:38:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: off>: {'status': 'motion'}
2019-01-05 16:39:01 DEBUG (Thread-2) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:01 DEBUG (Thread-2) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:01 DEBUG (Thread-2) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:01 DEBUG (Thread-2) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:01 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:01 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:07 DEBUG (Thread-11) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:07 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:07 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:07 DEBUG (Thread-11) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:07 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:07 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:13 DEBUG (Thread-22) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:13 DEBUG (Thread-22) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:13 DEBUG (Thread-22) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:13 DEBUG (Thread-22) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:13 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:13 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:19 DEBUG (Thread-12) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:19 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:19 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:19 DEBUG (Thread-12) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:19 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:19 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:25 DEBUG (Thread-8) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:25 DEBUG (Thread-8) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:25 DEBUG (Thread-8) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:25 DEBUG (Thread-8) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:25 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:25 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:31 DEBUG (Thread-6) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:31 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:31 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:31 DEBUG (Thread-6) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:31 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:31 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:37 DEBUG (Thread-19) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:37 DEBUG (Thread-19) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:37 DEBUG (Thread-19) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:37 DEBUG (Thread-19) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:37 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:37 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:43 DEBUG (Thread-10) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:43 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:43 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:43 DEBUG (Thread-10) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:43 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:43 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:49 DEBUG (Thread-6) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:49 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:49 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:49 DEBUG (Thread-6) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:55 DEBUG (Thread-21) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:39:55 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:39:55 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:55 DEBUG (Thread-21) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:39:55 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:39:55 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:00 DEBUG (Thread-10) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:00 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:00 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:00 DEBUG (Thread-10) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:00 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:00 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:06 DEBUG (Thread-16) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:06 DEBUG (Thread-16) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:06 DEBUG (Thread-16) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:06 DEBUG (Thread-16) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:06 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:06 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:12 DEBUG (Thread-21) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:12 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:12 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:12 DEBUG (Thread-21) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:12 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:12 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:18 DEBUG (Thread-6) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:18 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:18 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:18 DEBUG (Thread-6) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:18 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:18 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:24 DEBUG (Thread-7) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:24 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:24 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:24 DEBUG (Thread-7) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:24 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:24 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:30 DEBUG (Thread-12) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:30 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:30 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:30 DEBUG (Thread-12) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:30 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:30 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:36 DEBUG (Thread-11) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:36 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:36 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:36 DEBUG (Thread-11) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:36 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:36 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:42 DEBUG (Thread-4) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:42 DEBUG (Thread-4) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:42 DEBUG (Thread-4) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:42 DEBUG (Thread-4) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:42 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:42 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:47 DEBUG (Thread-11) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:47 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:47 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:47 DEBUG (Thread-11) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:47 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:47 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:53 DEBUG (Thread-18) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:53 DEBUG (Thread-18) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:53 DEBUG (Thread-18) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:53 DEBUG (Thread-18) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:53 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:53 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:59 DEBUG (Thread-12) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:40:59 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:40:59 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:59 DEBUG (Thread-12) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:40:59 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"no_motion":"120"}', 'cmd': 'report', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'no_motion': '120'}
2019-01-05 16:40:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'no_motion': '120'}
2019-01-05 16:41:05 DEBUG (Thread-10) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0002254951
2019-01-05 16:41:05 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0002254951"}'
2019-01-05 16:41:05 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd resp << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:41:05 DEBUG (Thread-10) [xiaomi_gateway] read_ack << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"voltage":3025,"lux":"8"}', 'cmd': 'read_ack', 'model': 'sensor_motion.aq2'}
2019-01-05 16:41:05 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'voltage': 3025, 'lux': '8'}
2019-01-05 16:41:05 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: off>: {'voltage': 3025, 'lux': '8'}
The motion sensor is one of the second generation (with lux). Do you see the state change after the black off interval of 2min?
The same capture of a 1gen motion sensor:
2019-01-05 16:53:45 DEBUG (Thread-21) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:53:45 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:53:45 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:53:45 DEBUG (Thread-21) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:53:45 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: off>: {'voltage': 3005}
2019-01-05 16:53:49 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"status":"motion"}', 'cmd': 'report', 'model': 'motion'}
2019-01-05 16:53:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: off>: {'status': 'motion'}
2019-01-05 16:53:51 DEBUG (Thread-16) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:53:51 DEBUG (Thread-16) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:53:51 DEBUG (Thread-16) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:53:51 DEBUG (Thread-16) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:53:51 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:53:57 DEBUG (Thread-7) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:53:57 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:53:57 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:53:57 DEBUG (Thread-7) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:53:57 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:03 DEBUG (Thread-12) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:03 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:03 DEBUG (Thread-12) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:03 DEBUG (Thread-12) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:03 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:09 DEBUG (Thread-5) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:09 DEBUG (Thread-5) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:09 DEBUG (Thread-5) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:09 DEBUG (Thread-5) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:09 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:15 DEBUG (Thread-7) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:15 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:15 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:15 DEBUG (Thread-7) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:15 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:21 DEBUG (Thread-3) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:21 DEBUG (Thread-3) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:21 DEBUG (Thread-3) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:21 DEBUG (Thread-3) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:21 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:27 DEBUG (Thread-6) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:27 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:27 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:27 DEBUG (Thread-6) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:27 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:33 DEBUG (Thread-4) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:33 DEBUG (Thread-4) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:33 DEBUG (Thread-4) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:33 DEBUG (Thread-4) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:33 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:39 DEBUG (Thread-22) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:39 DEBUG (Thread-22) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:39 DEBUG (Thread-22) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:39 DEBUG (Thread-22) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:39 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:45 DEBUG (Thread-5) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:45 DEBUG (Thread-5) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:45 DEBUG (Thread-5) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:45 DEBUG (Thread-5) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:45 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:51 DEBUG (Thread-8) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:51 DEBUG (Thread-8) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:51 DEBUG (Thread-8) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:51 DEBUG (Thread-8) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:51 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:54:57 DEBUG (Thread-17) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:54:57 DEBUG (Thread-17) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:54:57 DEBUG (Thread-17) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:57 DEBUG (Thread-17) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:54:57 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:03 DEBUG (Thread-2) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:03 DEBUG (Thread-2) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:03 DEBUG (Thread-2) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:03 DEBUG (Thread-2) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:03 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:09 DEBUG (Thread-21) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:09 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:09 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:09 DEBUG (Thread-21) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:09 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:15 DEBUG (Thread-10) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:15 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:15 DEBUG (Thread-10) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:15 DEBUG (Thread-10) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:15 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:21 DEBUG (Thread-20) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:21 DEBUG (Thread-20) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:21 DEBUG (Thread-20) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:21 DEBUG (Thread-20) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:21 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:27 DEBUG (Thread-7) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:27 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:27 DEBUG (Thread-7) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:27 DEBUG (Thread-7) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:27 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:33 DEBUG (Thread-3) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:33 DEBUG (Thread-3) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:33 DEBUG (Thread-3) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:33 DEBUG (Thread-3) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:33 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:39 DEBUG (Thread-21) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:39 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:39 DEBUG (Thread-21) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:39 DEBUG (Thread-21) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:39 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:45 DEBUG (Thread-11) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:45 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:45 DEBUG (Thread-11) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:45 DEBUG (Thread-11) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:45 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'voltage': 3005}
2019-01-05 16:55:48 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"no_motion":"120"}', 'cmd': 'report', 'model': 'motion'}
2019-01-05 16:55:48 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'no_motion': '120'}
2019-01-05 16:55:51 DEBUG (Thread-6) [custom_components.binary_sensor.xiaomi_aqara] Updating xiaomi sensor by polling: 158d0001b159f8
2019-01-05 16:55:51 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001b159f8"}'
2019-01-05 16:55:51 DEBUG (Thread-6) [xiaomi_gateway] _send_cmd resp << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:51 DEBUG (Thread-6) [xiaomi_gateway] read_ack << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"voltage":3005}', 'cmd': 'read_ack', 'model': 'motion'}
2019-01-05 16:55:51 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: off>: {'voltage': 3005}
Motion event: 16:53:49
No motion event: 16:55:48
-> Same 2min back off period like the 2gen sensor.
New insight: Polling is useless for this case. All requests ({ "cmd":"read","sid":"158d0002254951"}
) will be answered by
'data': '{"voltage":3025,"lux":"8"}'
# or
'data': '{"voltage":3005}'
Motion and “no_motion” is reported as MCAST message always:
2019-01-05 16:38:59 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"status":"motion"}', 'cmd': 'report', 'model': 'sensor_motion.aq2'}
2019-01-05 16:38:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'status': 'motion'}
2019-01-05 16:38:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: off>: {'status': 'motion'}
[...]
2019-01-05 16:40:59 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 16075, 'sid': '158d0002254951', 'data': '{"no_motion":"120"}', 'cmd': 'report', 'model': 'sensor_motion.aq2'}
2019-01-05 16:40:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d0002254951: 8.0>: {'no_motion': '120'}
2019-01-05 16:40:59 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0002254951: on>: {'no_motion': '120'}
$ egrep "status|no_motion" motion-1gen.txt
2019-01-05 16:53:49 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"status":"motion"}', 'cmd': 'report', 'model': 'motion'}
2019-01-05 16:53:49 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: off>: {'status': 'motion'}
2019-01-05 16:55:48 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'short_id': 26331, 'sid': '158d0001b159f8', 'data': '{"no_motion":"120"}', 'cmd': 'report', 'model': 'motion'}
2019-01-05 16:55:48 DEBUG (MainThread) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d0001b159f8: on>: {'no_motion': '120'}
Yup, I am seeing the same result. only after 120 min it PUSH the ‘no motion’. Regardless how much you pull in between does not give you the stats change. So I guess below 120 mins is not possible. I am not sure if anyone else has done it.
Thanks so much for looking in to this again. SCAN_INTERVAL dont change anything.
Someone managed to hardware mod it to 5 secs. Well hardware mod is not my way. I going to live with 120 second. This definitely impact the battery life.
This mod triggers the “calibration/position mode” of the sensor (always). It’s normally used once to find a good position for the motion sensor.
The poster says that after 1 year they still work
I managed to apply this mod using graphite pencil and now mi home app detect motion every 5 seconds, but HA still need about 1-2 minutes to update status of the motion sensor. I tried to do SCAN_INTERVAL = timedelta(seconds=10) but still no luck. Does anybody know how to manage this to work properly?
Which gateway do you own? acpartner.v3 or the lumi gateway?
I have lumi gateway.
May be the connection between the two contacts didn’t work property. Could you try to press the button instead? Does it work now for some minutes?
Maybe, but in mi home app motion get detected every 5 seconds on modified sensor and not modifed sensor still take long time before detecting movement again. So seems like contacts are fine?
I think I have solved my problems with automations not always working correctly: I have moved my Tradfri-hub to a better, more central location. Since then I have not experienced any problems
I got my second motion sensor today. Both are Aqara, my old one did only send every 2min, the new one spams it nonstop. They are both Model Q11LM and even have the same CMIT ID.
Only difference it may have is a) joining the zigbee2mqtt network, I have to do multiple tries until im in. Probably a long press or some special kind of combination swiched that? b) zigbee2mqtt v1.0 - dont know if related but “{{ ‘on’ == trigger.payload_json.occupancy }}” worked on the old one. for the new one i had to replace “on” with true. Even the mqtt log shows the same just a different order.
You’ve pressed the button to trigger the 5sec mode for some hours. Could you check the interval tomorrow again?
I have been struggling with the same problem and have hacked a solution that works pretty well for me.
I was using the sensor to control lights in the cooking area of our kitchen. I had timer set to nine minutes triggered by the motion sensor, but that became a problem when you are in the area preparing food as the motion sensor never leaves the on state and never restarts the timer, so the light goes off after nine minutes when the timer ends. You then have to go away for a couple of minutes for it to turn on again. To solve this I made another automation that runs every five minutes and restarts the timer if state of motion sensor is on. Its not elegant, but it works for now.
How about switching the lights off when the movement sensor switches to off?
I tried the timer-idea and have abandoned it again for the above principle. I also noticed that the sensor does not switch off when there is frequent movement. Which is good because then the lights stay on as long as the switch stays on.
A slightly better option is to give the chance to the movement sensor to detect movement again. I use this:
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158xxxxxxxx
to: 'off'
for:
minutes: 3
So the lights stay at least 5 minutes on (the usual 2 minutes from the sensor plus 3 more minutes after no movement).
Yes, But if you enter in the three minutes wait after switching to off state the sensor state will be on and light go off and do not switch on again before you leave the area for some minutes so the sensor can change state?