File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ def process_wocurtain(
66 data : bytes | None , mfr_data : bytes | None , reverse : bool = True
77) -> dict [str , bool | int ]:
88 """Process woCurtain/Curtain services data."""
9- if mfr_data and len (mfr_data ) >= 12 : # Curtain 3
9+ if mfr_data and len (mfr_data ) >= 13 : # Curtain 3
1010 device_data = mfr_data [8 :11 ]
1111 battery_data = mfr_data [12 ]
1212 elif mfr_data and len (mfr_data ) >= 11 :
Original file line number Diff line number Diff line change @@ -120,6 +120,38 @@ def test_parse_advertisement_data_curtain_passive():
120120 )
121121
122122
123+ def test_parse_advertisement_data_curtain_passive_12_bytes ():
124+ """Test parse_advertisement_data for curtain passive."""
125+ ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "any" )
126+ adv_data = generate_advertisement_data (
127+ manufacturer_data = {2409 : b"\xe7 \xab F\xac \x8f \x92 |\x0f \x00 \x11 \x04 \x00 " },
128+ service_data = {},
129+ rssi = - 80 ,
130+ )
131+ result = parse_advertisement_data (ble_device , adv_data , SwitchbotModel .CURTAIN )
132+ assert result == SwitchBotAdvertisement (
133+ address = "aa:bb:cc:dd:ee:ff" ,
134+ data = {
135+ "rawAdvData" : None ,
136+ "data" : {
137+ "calibration" : None ,
138+ "battery" : None ,
139+ "inMotion" : False ,
140+ "position" : 100 ,
141+ "lightLevel" : 1 ,
142+ "deviceChain" : 1 ,
143+ },
144+ "isEncrypted" : False ,
145+ "model" : "c" ,
146+ "modelFriendlyName" : "Curtain" ,
147+ "modelName" : SwitchbotModel .CURTAIN ,
148+ },
149+ device = ble_device ,
150+ rssi = - 80 ,
151+ active = False ,
152+ )
153+
154+
123155def test_parse_advertisement_data_curtain_position_zero ():
124156 """Test parse_advertisement_data for curtain position zero."""
125157 ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "any" )
You can’t perform that action at this time.
0 commit comments