lazcad / homeassistant

Home Assistant Development
249 stars 83 forks source link

door_window_sensor is not sending events #37

Closed PhyberApex closed 7 years ago

PhyberApex commented 7 years ago

Currently the component does not throw the events for the door_window_sensor.

Log file output (Loglevel debug)

17-03-25 11:07:28 DEBUG (Thread-18) [homeassistant.components.xiaomi] MCAST (report) << {'model': 'magnet', 'short_id': 19162, 'cmd': 'report', 'sid': 'xxx', 'data': '{"status":"close"}'}
17-03-25 11:07:28 DEBUG (Thread-9) [homeassistant.components.xiaomi] PUSH >> <Entity Door Window Sensor_158d000154b7c0: on>: {'status': 'close'}
17-03-25 11:07:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.door_window_sensor_xxx, old_state=<state binary_sensor.door_window_sensor_xxx=on; friendly_name=Balcony Door, device_class=opening, Open since=300 @ 2017-03-25T11:05:52.191358+01:00>, new_state=<state binary_sensor.door_window_sensor_xxx=off; friendly_name=Balcony Door, device_class=opening, Open since=0 @ 2017-03-25T11:07:28.397366+01:00>>

Ouput for motions sensor:

17-03-25 11:10:57 DEBUG (MainThread) [homeassistant.components.xiaomi] >> b'{ "cmd":"read","sid":"xxx"}'
17-03-25 11:10:57 DEBUG (MainThread) [homeassistant.components.xiaomi] << {'model': 'motion', 'short_id': 58128, 'cmd': 'read_ack', 'sid': 'xxx', 'data': '{"status":"motion"}'}
17-03-25 11:10:57 DEBUG (MainThread) [homeassistant.components.xiaomi] PUSH >> <Entity Motion Sensor_xxx: on>: {'status': 'motion'}
17-03-25 11:10:57 INFO (MainThread) [homeassistant.core] Bus:Handling <Event motion[L]: entity_id=binary_sensor.motion_sensor_xxx>
tam-wh commented 7 years ago

Door window sensor is not programmed to send an event. You can just use State for automation. Why do you need it to be an event?

Motion sensor is different because the sensor can be retrigger when it is still in Motion state. A door sensor must be closed before it can be reopened

PhyberApex commented 7 years ago

I don't need it to be an event. I am using states now. Just thought it was supposed to send events as mentioned on the Readme.

~Cheers

tam-wh commented 7 years ago

You know what, i just remembered that there's a pull request that added event to the door sensor. I think there's no need for event now so I'll update readme