@@ -322,6 +322,71 @@ def test_parse_advertisement_data_curtain_fully_open():
322322 )
323323
324324
325+ def test_parse_advertisement_data_curtain3 ():
326+ """Test parse_advertisement_data for curtain 3."""
327+ ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "any" )
328+ adv_data = generate_advertisement_data (
329+ manufacturer_data = {2409 : b"\xaa \xbb \xcc \xdd \xee \xff \xf7 \x07 \x00 \x11 \x04 \x00 \x49 " },
330+ service_data = {"0000fd3d-0000-1000-8000-00805f9b34fb" : b"{\xc0 \x49 \x00 \x11 \x04 " },
331+ rssi = - 80 ,
332+ )
333+
334+ result = parse_advertisement_data (ble_device , adv_data )
335+ assert result == SwitchBotAdvertisement (
336+ address = "aa:bb:cc:dd:ee:ff" ,
337+ data = {
338+ "rawAdvData" : b"{\xc0 \x49 \x00 \x11 \x04 " ,
339+ "data" : {
340+ "calibration" : True ,
341+ "battery" : 73 ,
342+ "inMotion" : False ,
343+ "position" : 100 ,
344+ "lightLevel" : 1 ,
345+ "deviceChain" : 1 ,
346+ },
347+ "isEncrypted" : False ,
348+ "model" : "{" ,
349+ "modelFriendlyName" : "Curtain 3" ,
350+ "modelName" : SwitchbotModel .CURTAIN ,
351+ },
352+ device = ble_device ,
353+ rssi = - 80 ,
354+ active = True ,
355+ )
356+
357+
358+ def test_parse_advertisement_data_curtain3_passive ():
359+ """Test parse_advertisement_data for curtain passive."""
360+ ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "any" )
361+ adv_data = generate_advertisement_data (
362+ manufacturer_data = {2409 : b"\xaa \xbb \xcc \xdd \xee \xff \xf7 \x07 \x00 \x11 \x04 \x00 \x49 " },
363+ service_data = {},
364+ rssi = - 80 ,
365+ )
366+ result = parse_advertisement_data (ble_device , adv_data , SwitchbotModel .CURTAIN )
367+ assert result == SwitchBotAdvertisement (
368+ address = "aa:bb:cc:dd:ee:ff" ,
369+ data = {
370+ "rawAdvData" : None ,
371+ "data" : {
372+ "calibration" : None ,
373+ "battery" : 73 ,
374+ "inMotion" : False ,
375+ "position" : 100 ,
376+ "lightLevel" : 1 ,
377+ "deviceChain" : 1 ,
378+ },
379+ "isEncrypted" : False ,
380+ "model" : "c" ,
381+ "modelFriendlyName" : "Curtain" ,
382+ "modelName" : SwitchbotModel .CURTAIN ,
383+ },
384+ device = ble_device ,
385+ rssi = - 80 ,
386+ active = False ,
387+ )
388+
389+
325390def test_parse_advertisement_data_contact ():
326391 """Test parse_advertisement_data for the contact sensor."""
327392 ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "any" )
0 commit comments