Skip to content

Commit

Permalink
Add support Sonoff SNZB-05P #1496
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Sep 23, 2024
1 parent 14f6db9 commit 2589ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/sonoff/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ def set_state(self, params: dict):
self._attr_is_on = params[self.param] == "brighter"


class XWaterSensor(XEntity, BinarySensorEntity):
param = "water"
uid = "moisture"
_attr_device_class = BinarySensorDeviceClass.MOISTURE

def set_state(self, params: dict):
self._attr_is_on = params[self.param] == 1


# noinspection PyAbstractClass
class XRemoteSensor(BinarySensorEntity, RestoreEntity):
_attr_is_on = False
Expand Down
3 changes: 3 additions & 0 deletions custom_components/sonoff/core/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
XZigbeeMotion,
XHumanSensor,
XLightSensor,
XWaterSensor,
)
from ..climate import XClimateNS, XClimateTH, XThermostat
from ..core.entity import XEntity
Expand Down Expand Up @@ -428,6 +429,8 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type:
Battery,
], # https://github.com/AlexxIT/SonoffLAN/issues/1166
7016: [XHumanSensor, XLightSensor, XSensitivity, ZRSSI], # SNZB-06P
# SNZB-05P https://github.com/AlexxIT/SonoffLAN/issues/1496
7019: [XWaterSensor, Battery],
}


Expand Down

0 comments on commit 2589ee2

Please sign in to comment.