mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add Leak detect entity for YoLink water meter controller (#131682)
This commit is contained in:
parent
b1fe247eed
commit
a6f6317299
@ -12,6 +12,7 @@ from yolink.const import (
|
||||
ATTR_DEVICE_LEAK_SENSOR,
|
||||
ATTR_DEVICE_MOTION_SENSOR,
|
||||
ATTR_DEVICE_VIBRATION_SENSOR,
|
||||
ATTR_DEVICE_WATER_METER_CONTROLLER,
|
||||
)
|
||||
from yolink.device import YoLinkDevice
|
||||
|
||||
@ -44,6 +45,7 @@ SENSOR_DEVICE_TYPE = [
|
||||
ATTR_DEVICE_LEAK_SENSOR,
|
||||
ATTR_DEVICE_VIBRATION_SENSOR,
|
||||
ATTR_DEVICE_CO_SMOKE_SENSOR,
|
||||
ATTR_DEVICE_WATER_METER_CONTROLLER,
|
||||
]
|
||||
|
||||
|
||||
@ -84,6 +86,15 @@ SENSOR_TYPES: tuple[YoLinkBinarySensorEntityDescription, ...] = (
|
||||
value=lambda state: state.get("smokeAlarm"),
|
||||
exists_fn=lambda device: device.device_type == ATTR_DEVICE_CO_SMOKE_SENSOR,
|
||||
),
|
||||
YoLinkBinarySensorEntityDescription(
|
||||
key="pipe_leak_detected",
|
||||
state_key="alarm",
|
||||
device_class=BinarySensorDeviceClass.MOISTURE,
|
||||
value=lambda state: state.get("leak") if state is not None else None,
|
||||
exists_fn=lambda device: (
|
||||
device.device_type == ATTR_DEVICE_WATER_METER_CONTROLLER
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user