Skip to content

Commit

Permalink
Add support Sonoff SNZB-03P #1435
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Sep 7, 2024
1 parent 20a843e commit 3b5d4c6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/sonoff/core/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions tests/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3b5d4c6

Please sign in to comment.