Skip to content

Commit c6c6227

Browse files
authored
Add YoLink YS7A12 support (home-assistant#148588)
1 parent 193b322 commit c6c6227

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

homeassistant/components/yolink/binary_sensor.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
ATTR_DEVICE_LEAK_SENSOR,
1313
ATTR_DEVICE_MOTION_SENSOR,
1414
ATTR_DEVICE_MULTI_WATER_METER_CONTROLLER,
15+
ATTR_DEVICE_SMOKE_ALARM,
1516
ATTR_DEVICE_VIBRATION_SENSOR,
1617
ATTR_DEVICE_WATER_METER_CONTROLLER,
1718
)
@@ -53,6 +54,7 @@ class YoLinkBinarySensorEntityDescription(BinarySensorEntityDescription):
5354
ATTR_DEVICE_CO_SMOKE_SENSOR,
5455
ATTR_DEVICE_WATER_METER_CONTROLLER,
5556
ATTR_DEVICE_MULTI_WATER_METER_CONTROLLER,
57+
ATTR_DEVICE_SMOKE_ALARM,
5658
]
5759

5860

@@ -90,8 +92,10 @@ class YoLinkBinarySensorEntityDescription(BinarySensorEntityDescription):
9092
YoLinkBinarySensorEntityDescription(
9193
key="smoke_detected",
9294
device_class=BinarySensorDeviceClass.SMOKE,
93-
value=lambda state: state.get("smokeAlarm"),
94-
exists_fn=lambda device: device.device_type == ATTR_DEVICE_CO_SMOKE_SENSOR,
95+
value=lambda state: state.get("smokeAlarm") is True
96+
or state.get("denseSmokeAlarm") is True,
97+
exists_fn=lambda device: device.device_type
98+
in [ATTR_DEVICE_CO_SMOKE_SENSOR, ATTR_DEVICE_SMOKE_ALARM],
9599
),
96100
YoLinkBinarySensorEntityDescription(
97101
key="pipe_leak_detected",

homeassistant/components/yolink/sensor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ATTR_DEVICE_POWER_FAILURE_ALARM,
2222
ATTR_DEVICE_SIREN,
2323
ATTR_DEVICE_SMART_REMOTER,
24+
ATTR_DEVICE_SMOKE_ALARM,
2425
ATTR_DEVICE_SOIL_TH_SENSOR,
2526
ATTR_DEVICE_SWITCH,
2627
ATTR_DEVICE_TH_SENSOR,
@@ -106,6 +107,7 @@ class YoLinkSensorEntityDescription(SensorEntityDescription):
106107
ATTR_DEVICE_CO_SMOKE_SENSOR,
107108
ATTR_GARAGE_DOOR_CONTROLLER,
108109
ATTR_DEVICE_SOIL_TH_SENSOR,
110+
ATTR_DEVICE_SMOKE_ALARM,
109111
]
110112

111113
BATTERY_POWER_SENSOR = [
@@ -126,12 +128,14 @@ class YoLinkSensorEntityDescription(SensorEntityDescription):
126128
ATTR_DEVICE_WATER_METER_CONTROLLER,
127129
ATTR_DEVICE_MULTI_WATER_METER_CONTROLLER,
128130
ATTR_DEVICE_SOIL_TH_SENSOR,
131+
ATTR_DEVICE_SMOKE_ALARM,
129132
]
130133

131134
MCU_DEV_TEMPERATURE_SENSOR = [
132135
ATTR_DEVICE_LEAK_SENSOR,
133136
ATTR_DEVICE_MOTION_SENSOR,
134137
ATTR_DEVICE_CO_SMOKE_SENSOR,
138+
ATTR_DEVICE_SMOKE_ALARM,
135139
]
136140

137141
NONE_HUMIDITY_SENSOR_MODELS = [

0 commit comments

Comments
 (0)