Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions switchbot/adv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ class SwitchbotSupportedType(TypedDict):
"func": process_light,
"manufacturer_id": 2409,
},
"?": {
"modelName": SwitchbotModel.PLUG_MINI_EU,
"modelFriendlyName": "Plug Mini (EU)",
"func": process_relay_switch_1pm,
"manufacturer_id": 2409,
},
}

_SWITCHBOT_MODEL_TO_CHAR = {
Expand Down
1 change: 1 addition & 0 deletions switchbot/const/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class SwitchbotModel(StrEnum):
RELAY_SWITCH_2PM = "Relay Switch 2PM"
STRIP_LIGHT_3 = "Strip Light 3"
FLOOR_LAMP = "Floor Lamp"
PLUG_MINI_EU = "Plug Mini (EU)"


__all__ = [
Expand Down
1 change: 1 addition & 0 deletions switchbot/devices/relay_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def update_from_advertisement(self, advertisement: SwitchBotAdvertisement) -> No
if self._model in (
SwitchbotModel.RELAY_SWITCH_1PM,
SwitchbotModel.RELAY_SWITCH_2PM,
SwitchbotModel.PLUG_MINI_EU,
):
if channel is None:
adv_data["voltage"] = self._get_adv_value("voltage") or 0
Expand Down
39 changes: 39 additions & 0 deletions tests/test_adv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3366,6 +3366,19 @@ def test_humidifer_with_empty_data() -> None:
"Color Bulb",
SwitchbotModel.COLOR_BULB,
),
AdvTestCase(
b"\x94\xa9\x90T\x85^?\xa1\x00\x00\x04\xe6\x00\x00\x00\x00",
b"?\x00\x00\x00",
{
"isOn": True,
"power": 1254.0,
"sequence_number": 63,
"switchMode": True,
},
"?",
"Plug Mini (EU)",
SwitchbotModel.PLUG_MINI_EU,
),
],
)
def test_adv_active(test_case: AdvTestCase) -> None:
Expand Down Expand Up @@ -3520,6 +3533,19 @@ def test_adv_active(test_case: AdvTestCase) -> None:
"Color Bulb",
SwitchbotModel.COLOR_BULB,
),
AdvTestCase(
b"\x94\xa9\x90T\x85^?\xa1\x00\x00\x04\xe6\x00\x00\x00\x00",
None,
{
"isOn": True,
"power": 1254.0,
"sequence_number": 63,
"switchMode": True,
},
"?",
"Plug Mini (EU)",
SwitchbotModel.PLUG_MINI_EU,
),
],
)
def test_adv_passive(test_case: AdvTestCase) -> None:
Expand Down Expand Up @@ -3648,6 +3674,19 @@ def test_adv_passive(test_case: AdvTestCase) -> None:
"Color Bulb",
SwitchbotModel.COLOR_BULB,
),
AdvTestCase(
None,
b"?\x00\x00\x00",
{
"isOn": True,
"power": 1254.0,
"sequence_number": 63,
"switchMode": True,
},
"?",
"Plug Mini (EU)",
SwitchbotModel.PLUG_MINI_EU,
),
],
)
def test_adv_with_empty_data(test_case: AdvTestCase) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/test_relay_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
(b";\x00\x00\x00", SwitchbotModel.RELAY_SWITCH_1),
(b"<\x00\x00\x00", SwitchbotModel.RELAY_SWITCH_1PM),
(b">\x00\x00\x00", SwitchbotModel.GARAGE_DOOR_OPENER),
(b"?\x00\x00\x00", SwitchbotModel.PLUG_MINI_EU),
]


Expand Down