Skip to content

Commit 6e43198

Browse files
authored
Fix meter being seen as blub with passive only (#155)
1 parent 2c4884b commit 6e43198

File tree

2 files changed

+2
-33
lines changed

2 files changed

+2
-33
lines changed

switchbot/adv_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ class SwitchbotSupportedType(TypedDict):
8282
"modelName": SwitchbotModel.METER,
8383
"modelFriendlyName": "Meter",
8484
"func": process_wosensorth,
85+
"manufacturer_id": 2409,
8586
},
8687
"i": {
8788
"modelName": SwitchbotModel.METER,
8889
"modelFriendlyName": "Meter Plus",
8990
"func": process_wosensorth,
91+
"manufacturer_id": 2409,
9092
},
9193
"g": {
9294
"modelName": SwitchbotModel.PLUG_MINI,
@@ -103,7 +105,6 @@ class SwitchbotSupportedType(TypedDict):
103105
"modelFriendlyName": "Color Bulb",
104106
"func": process_color_bulb,
105107
"manufacturer_id": 2409,
106-
"manufacturer_data_length": 11,
107108
},
108109
"q": {
109110
"modelName": SwitchbotModel.CEILING_LIGHT,

tests/test_adv_parser.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -645,38 +645,6 @@ def test_bulb_active():
645645
)
646646

647647

648-
def test_bulb_passive():
649-
"""Test parsing bulb as passive."""
650-
ble_device = BLEDevice("aa:bb:cc:dd:ee:ff", "any")
651-
adv_data = generate_advertisement_data(
652-
manufacturer_data={2409: b"\x84\xf7\x03\xb4\xcbz\x03\xe4!\x00\x00"},
653-
service_data={},
654-
tx_power=-127,
655-
rssi=-50,
656-
)
657-
result = parse_advertisement_data(ble_device, adv_data, SwitchbotModel.BOT)
658-
assert result == SwitchBotAdvertisement(
659-
address="aa:bb:cc:dd:ee:ff",
660-
data={
661-
"data": {
662-
"brightness": 100,
663-
"color_mode": 1,
664-
"delay": False,
665-
"isOn": True,
666-
"loop_index": 0,
667-
"preset": False,
668-
"sequence_number": 3,
669-
"speed": 0,
670-
},
671-
"isEncrypted": False,
672-
"model": "u",
673-
"modelFriendlyName": "Color Bulb",
674-
"modelName": SwitchbotModel.COLOR_BULB,
675-
"rawAdvData": None,
676-
},
677-
device=ble_device,
678-
rssi=-50,
679-
)
680648

681649

682650
def test_lightstrip_passive():

0 commit comments

Comments
 (0)