@@ -180,6 +180,80 @@ def test_parse_advertisement_data_curtain_firmware_six_position_100_other_rssi()
180180 )
181181
182182
183+ def test_parse_advertisement_data_curtain_fully_closed ():
184+ """Test parse_advertisement_data with firmware six fully closed."""
185+ ble_device = BLEDevice ("aa:bb:cc:dd:ee:ff" , "any" )
186+ adv_data = generate_advertisement_data (
187+ local_name = "WoCurtain" ,
188+ manufacturer_data = {2409 : b"\xc1 \xc7 '}U\xab \" \x0f d\x11 \x04 " },
189+ service_data = {"0000fd3d-0000-1000-8000-00805f9b34fb" : b"c\xc0 Sd\x11 \x04 " },
190+ service_uuids = [
191+ "00001800-0000-1000-8000-00805f9b34fb" ,
192+ "00001801-0000-1000-8000-00805f9b34fb" ,
193+ "cba20d00-224d-11e6-9fb8-0002a5d5c51b" ,
194+ ],
195+ rssi = 1 ,
196+ )
197+ result = parse_advertisement_data (ble_device , adv_data )
198+ assert result == SwitchBotAdvertisement (
199+ address = "aa:bb:cc:dd:ee:ff" ,
200+ data = {
201+ "rawAdvData" : b"c\xc0 Sd\x11 \x04 " ,
202+ "data" : {
203+ "calibration" : True ,
204+ "battery" : 83 ,
205+ "inMotion" : False ,
206+ "position" : 0 ,
207+ "lightLevel" : 1 ,
208+ "deviceChain" : 1 ,
209+ },
210+ "isEncrypted" : False ,
211+ "model" : "c" ,
212+ "modelFriendlyName" : "Curtain" ,
213+ "modelName" : SwitchbotModel .CURTAIN ,
214+ },
215+ device = ble_device ,
216+ rssi = 1 ,
217+ )
218+
219+
220+ def test_parse_advertisement_data_curtain_fully_open ():
221+ """Test parse_advertisement_data with firmware six fully open."""
222+ ble_device = BLEDevice ("aa:bb:cc:dd:ee:ff" , "any" )
223+ adv_data = generate_advertisement_data (
224+ local_name = "WoCurtain" ,
225+ manufacturer_data = {2409 : b"\xc1 \xc7 '}U\xab %\x0f \x00 \x11 \x04 " },
226+ service_data = {"0000fd3d-0000-1000-8000-00805f9b34fb" : b"c\xc0 S\x00 \x11 \x04 " },
227+ service_uuids = [
228+ "00001800-0000-1000-8000-00805f9b34fb" ,
229+ "00001801-0000-1000-8000-00805f9b34fb" ,
230+ "cba20d00-224d-11e6-9fb8-0002a5d5c51b" ,
231+ ],
232+ rssi = 1 ,
233+ )
234+ result = parse_advertisement_data (ble_device , adv_data )
235+ assert result == SwitchBotAdvertisement (
236+ address = "aa:bb:cc:dd:ee:ff" ,
237+ data = {
238+ "rawAdvData" : b"c\xc0 S\x00 \x11 \x04 " ,
239+ "data" : {
240+ "calibration" : True ,
241+ "battery" : 83 ,
242+ "inMotion" : False ,
243+ "position" : 100 ,
244+ "lightLevel" : 1 ,
245+ "deviceChain" : 1 ,
246+ },
247+ "isEncrypted" : False ,
248+ "model" : "c" ,
249+ "modelFriendlyName" : "Curtain" ,
250+ "modelName" : SwitchbotModel .CURTAIN ,
251+ },
252+ device = ble_device ,
253+ rssi = 1 ,
254+ )
255+
256+
183257def test_parse_advertisement_data_contact ():
184258 """Test parse_advertisement_data for the contact sensor."""
185259 ble_device = BLEDevice ("aa:bb:cc:dd:ee:ff" , "any" )
0 commit comments