Skip to content

Commit 2589ee2

Browse files
committed
Add support Sonoff SNZB-05P #1496
1 parent 14f6db9 commit 2589ee2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

custom_components/sonoff/binary_sensor.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ def set_state(self, params: dict):
8989
self._attr_is_on = params[self.param] == "brighter"
9090

9191

92+
class XWaterSensor(XEntity, BinarySensorEntity):
93+
param = "water"
94+
uid = "moisture"
95+
_attr_device_class = BinarySensorDeviceClass.MOISTURE
96+
97+
def set_state(self, params: dict):
98+
self._attr_is_on = params[self.param] == 1
99+
100+
92101
# noinspection PyAbstractClass
93102
class XRemoteSensor(BinarySensorEntity, RestoreEntity):
94103
_attr_is_on = False

custom_components/sonoff/core/devices.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
XZigbeeMotion,
2525
XHumanSensor,
2626
XLightSensor,
27+
XWaterSensor,
2728
)
2829
from ..climate import XClimateNS, XClimateTH, XThermostat
2930
from ..core.entity import XEntity
@@ -428,6 +429,8 @@ def spec(cls, base: str = None, enabled: bool = None, **kwargs) -> type:
428429
Battery,
429430
], # https://github.com/AlexxIT/SonoffLAN/issues/1166
430431
7016: [XHumanSensor, XLightSensor, XSensitivity, ZRSSI], # SNZB-06P
432+
# SNZB-05P https://github.com/AlexxIT/SonoffLAN/issues/1496
433+
7019: [XWaterSensor, Battery],
431434
}
432435

433436

0 commit comments

Comments
 (0)