Skip to content

Commit

Permalink
Add RSSI to ZBMINIL2 and SNZB-06P #1398
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed May 1, 2024
1 parent 0cd900f commit be38fff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/sonoff/core/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type:
LED = spec(XToggle, param="sledOnline", uid="led", enabled=False)
RSSI = spec(XSensor, param="rssi", enabled=False)
PULSE = spec(XToggle, param="pulse", enabled=False)
ZRSSI = spec(XSensor, param="subDevRssi", uid="rssi", enabled=False)

SPEC_SWITCH = [XSwitch, LED, RSSI, PULSE, XPulseWidth]
SPEC_1CH = [Switch1, LED, RSSI]
Expand Down Expand Up @@ -398,13 +399,16 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type:
XRemoteButton,
Battery,
],
# https://github.com/AlexxIT/SonoffLAN/issues/1398
7004: [XSwitch, ZRSSI], # ZBMINIL2
# https://github.com/AlexxIT/SonoffLAN/issues/1283
7006: [XZigbeeCover, spec(XSensor, param="battery")],
7014: [
spec(XSensor100, param="temperature"),
spec(XSensor100, param="humidity"),
Battery,
], # https://github.com/AlexxIT/SonoffLAN/issues/1166
7016: [ZRSSI], # SNZB-06P
}


Expand Down
22 changes: 22 additions & 0 deletions tests/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -1874,3 +1874,25 @@ def test_issue1386():
light: XT5Light = next(i for i in entities if isinstance(i, XT5Light))
light.internal_update({"lightMode": 101})
assert light.hass.states.get(light.entity_id).state == "off"


def test_zbminil2():
device = {
"extra": {"uiid": 7004},
"params": {
"bindInfos": "***",
"subDevId": "4e0560fefff410347004",
"parentid": "100202124f",
"fwVersion": "1.0.14",
"switch": "on",
"startup": "stay",
"subDevRssiSetting": {"active": 60, "duration": 5},
"subDevRssi": -61,
"sledOnline": "on",
},
"model": "ZBMINIL2",
}

entities = get_entitites(device)
assert entities[0].state == "on"
assert entities[1].state == -61

0 comments on commit be38fff

Please sign in to comment.