From 185a7e36c7e4d3f08546e73a3cc148313fc553a3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 17 Nov 2024 05:25:30 -0600 Subject: [PATCH 1/2] Fix Meter Pro being detected as a light strip without active scans --- switchbot/adv_parser.py | 1 - 1 file changed, 1 deletion(-) diff --git a/switchbot/adv_parser.py b/switchbot/adv_parser.py index 2a47121..c27aae5 100644 --- a/switchbot/adv_parser.py +++ b/switchbot/adv_parser.py @@ -69,7 +69,6 @@ class SwitchbotSupportedType(TypedDict): "modelFriendlyName": "Light Strip", "func": process_wostrip, "manufacturer_id": 2409, - "manufacturer_data_length": 16, }, "{": { "modelName": SwitchbotModel.CURTAIN, From e1ce2d32cf07f1a15ffbf289ddd3a4d858691abf Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 17 Nov 2024 05:26:20 -0600 Subject: [PATCH 2/2] Fix Meter Pro being detected as a light strip without active scans --- tests/test_adv_parser.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/tests/test_adv_parser.py b/tests/test_adv_parser.py index 83525d5..93b4b9c 100644 --- a/tests/test_adv_parser.py +++ b/tests/test_adv_parser.py @@ -807,43 +807,6 @@ def test_bulb_active(): ) -def test_lightstrip_passive(): - """Test parsing lightstrip as passive.""" - ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any") - adv_data = generate_advertisement_data( - manufacturer_data={ - 2409: b"`U\xf9(\xe5\x96\x00d\x02\xb0\x00\x00\x00\x00\x00\x00" - }, - service_data={}, - tx_power=-127, - rssi=-50, - ) - result = parse_advertisement_data(ble_device, adv_data) - assert result == SwitchBotAdvertisement( - address="aa:bb:cc:dd:ee:ff", - data={ - "data": { - "brightness": 100, - "color_mode": 2, - "delay": False, - "isOn": False, - "loop_index": 0, - "preset": False, - "sequence_number": 0, - "speed": 48, - }, - "isEncrypted": False, - "model": "r", - "modelFriendlyName": "Light Strip", - "modelName": SwitchbotModel.LIGHT_STRIP, - "rawAdvData": None, - }, - device=ble_device, - rssi=-50, - active=False, - ) - - def test_wosensor_passive_and_active(): """Test parsing wosensor as passive with active data as well.""" ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")