From 3b5d4c66d5cc60f74b34e16e4e9fe755f5ae6a18 Mon Sep 17 00:00:00 2001 From: Alex X Date: Sat, 7 Sep 2024 15:37:39 +0300 Subject: [PATCH] Add support Sonoff SNZB-03P #1435 --- custom_components/sonoff/core/devices.py | 4 +++- tests/test_entity.py | 25 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/custom_components/sonoff/core/devices.py b/custom_components/sonoff/core/devices.py index 744eca4..027dece 100644 --- a/custom_components/sonoff/core/devices.py +++ b/custom_components/sonoff/core/devices.py @@ -402,8 +402,10 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type: spec(XZigbeeSwitches, channel=3, uid="4"), ], 7000: [XRemoteButton, Battery], + # https://github.com/AlexxIT/SonoffLAN/issues/1435 + 7002: [XZigbeeMotion, XLightSensor, Battery, ZRSSI], # SNZB-03P # https://github.com/AlexxIT/SonoffLAN/issues/1439 - 7003: [DoorLock, Battery], # SNZB-04P + 7003: [DoorLock, Battery, ZRSSI], # SNZB-04P # https://github.com/AlexxIT/SonoffLAN/issues/1398 7004: [XSwitch, ZRSSI], # ZBMINIL2 # https://github.com/AlexxIT/SonoffLAN/issues/1283 diff --git a/tests/test_entity.py b/tests/test_entity.py index 0df3caf..f4309a1 100644 --- a/tests/test_entity.py +++ b/tests/test_entity.py @@ -1934,3 +1934,28 @@ def test_1394(): "light_type": 1, "mode": 1, } + + +def test_snzb_03p(): + device = { + "extra": {"uiid": 7002}, + "params": { + "fwVersion": "2.2.1", + "battery": 100, + "trigTime": "1717890285000", + "supportPowConfig": 1, + "subDevRssi": -68, + "motion": 1, + "subDevRssiSetting": {"active": 60, "duration": 5}, + "key": 0, + "detectInterval": 10, + "brState": "brighter", + }, + "model": "SNZB-03P", + } + + entities = get_entitites(device) + assert entities[0].state == "on" + assert entities[1].state == "on" + assert entities[2].state == 100 + assert entities[3].state == -68