File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 44
55def process_wocontact (data : bytes , mfr_data : bytes | None ) -> dict [str , bool | int ]:
66 """Process woContact Sensor services data."""
7+ contact_timeout = data [3 ] & 0b00000110 == 0b00000110
8+ contact_open = data [3 ] & 0b00000010 == 0b00000010
79 return {
810 "tested" : bool (data [1 ] & 0b10000000 ),
911 "motion_detected" : bool (data [1 ] & 0b01000000 ),
1012 "battery" : data [2 ] & 0b01111111 ,
11- "contact_open" : data [ 3 ] & 0b00000010 == 0b00000010 ,
12- "contact_timeout" : data [ 3 ] & 0b00000110 == 0b00000110 ,
13+ "contact_open" : contact_open or contact_timeout , # timeout still means its open
14+ "contact_timeout" : contact_timeout ,
1315 "is_light" : bool (data [3 ] & 0b00000001 ),
1416 "button_count" : (data [8 ] & 0b00001111 ),
1517 }
You can’t perform that action at this time.
0 commit comments