File tree Expand file tree Collapse file tree 2 files changed +2
-33
lines changed Expand file tree Collapse file tree 2 files changed +2
-33
lines changed Original file line number Diff line number Diff line change 4141)
4242MFR_DATA_ORDER = (2409 , 741 , 89 )
4343
44- APPLE_MANUFACTURER_ID = 76
45-
4644
4745class SwitchbotSupportedType (TypedDict ):
4846 """Supported type of Switchbot."""
@@ -250,14 +248,10 @@ def parse_advertisement_data(
250248
251249 _mfr_data = None
252250 _mfr_id = None
253- manufacturer_data = advertisement_data .manufacturer_data
254- if APPLE_MANUFACTURER_ID in manufacturer_data :
255- return None
256-
257251 for mfr_id in MFR_DATA_ORDER :
258- if mfr_id in manufacturer_data :
252+ if mfr_id in advertisement_data . manufacturer_data :
259253 _mfr_id = mfr_id
260- _mfr_data = manufacturer_data [mfr_id ]
254+ _mfr_data = advertisement_data . manufacturer_data [mfr_id ]
261255 break
262256
263257 if _mfr_data is None and _service_data is None :
Original file line number Diff line number Diff line change @@ -1970,28 +1970,3 @@ def test_remote_passive() -> None:
19701970 rssi = - 97 ,
19711971 active = False ,
19721972 )
1973-
1974-
1975- def test_parse_advertisement_ignores_devices_with_apple_manufacturer_id ():
1976- """Test parse_advertisement_data ignores devices with apple manufacturer id."""
1977- ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "any" )
1978- adv_data = generate_advertisement_data (
1979- local_name = "WoCurtain" ,
1980- manufacturer_data = {
1981- 89 : b"\xcc \xf4 \xc4 \xf9 \xac l" ,
1982- 2409 : b"\xcc \xf4 \xc4 \xf9 \xac l\xe2 \x0f \x00 \x12 \x04 " ,
1983- 76 : b"\x10 " ,
1984- },
1985- service_data = {
1986- "00000d00-0000-1000-8000-00805f9b34fb" : b"c\xd0 Yd\x11 \x04 " ,
1987- "0000fd3d-0000-1000-8000-00805f9b34fb" : b"c\xc0 d\x00 \x12 \x04 " ,
1988- },
1989- service_uuids = [
1990- "00001800-0000-1000-8000-00805f9b34fb" ,
1991- "00001801-0000-1000-8000-00805f9b34fb" ,
1992- "cba20d00-224d-11e6-9fb8-0002a5d5c51b" ,
1993- ],
1994- rssi = - 2 ,
1995- )
1996- result = parse_advertisement_data (ble_device , adv_data )
1997- assert result is None
You can’t perform that action at this time.
0 commit comments