@@ -123,6 +123,20 @@ def _process_wocontact(data: bytes, mfr_data: bytes | None) -> dict[str, bool |
123123 }
124124
125125
126+ def _process_wopresence (data : bytes , mfr_data : bytes | None ) -> dict [str , bool | int ]:
127+ """Process WoPresence Sensor services data."""
128+ return {
129+ "tested" : bool (data [1 ] & 0b10000000 ),
130+ "motion_detected" : bool (data [1 ] & 0b01000000 ),
131+ "battery" : data [2 ] & 0b01111111 ,
132+ "led" : (data [5 ] & 0b00100000 ) >> 5 ,
133+ "iot" : (data [5 ] & 0b00010000 ) >> 4 ,
134+ "sense_distance" : (data [5 ] & 0b00001100 ) >> 2 ,
135+ "light_intensity" : data [5 ] & 0b00000011 ,
136+ "is_light" : bool (data [5 ] & 0b00000010 ),
137+ }
138+
139+
126140def _process_woplugmini (data : bytes , mfr_data : bytes | None ) -> dict [str , bool | int ]:
127141 """Process plug mini."""
128142 return {
@@ -157,6 +171,7 @@ def parse_advertisement_data(
157171 supported_types : dict [str , dict [str , Any ]] = {
158172 "d" : {"modelName" : "WoContact" , "func" : _process_wocontact },
159173 "H" : {"modelName" : "WoHand" , "func" : _process_wohand },
174+ "s" : {"modelName" : "WoPresence" , "func" : _process_wopresence },
160175 "c" : {"modelName" : "WoCurtain" , "func" : _process_wocurtain },
161176 "T" : {"modelName" : "WoSensorTH" , "func" : _process_wosensorth },
162177 "i" : {"modelName" : "WoSensorTH" , "func" : _process_wosensorth },
0 commit comments