Add Smoke Detector (ywbj) device support to Tuya (#58170)
This commit is contained in:
parent
ea2e94a4e5
commit
3c52bc214d
3 changed files with 40 additions and 0 deletions
|
@ -10,6 +10,7 @@ from homeassistant.components.binary_sensor import (
|
|||
DEVICE_CLASS_MOISTURE,
|
||||
DEVICE_CLASS_MOTION,
|
||||
DEVICE_CLASS_SAFETY,
|
||||
DEVICE_CLASS_SMOKE,
|
||||
DEVICE_CLASS_TAMPER,
|
||||
DEVICE_CLASS_VIBRATION,
|
||||
BinarySensorEntity,
|
||||
|
@ -98,6 +99,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||
device_class=DEVICE_CLASS_TAMPER,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# PIR Detector
|
||||
# https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80
|
||||
|
@ -128,6 +130,21 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# Smoke Detector
|
||||
# https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952
|
||||
"ywbj": (
|
||||
TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.SMOKE_SENSOR_STATUS,
|
||||
device_class=DEVICE_CLASS_SMOKE,
|
||||
on_value="alarm",
|
||||
),
|
||||
TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.SMOKE_SENSOR_STATE,
|
||||
device_class=DEVICE_CLASS_SMOKE,
|
||||
on_value="1",
|
||||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# Vibration Sensor
|
||||
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
|
||||
"zd": (
|
||||
|
|
|
@ -132,6 +132,7 @@ class DPCode(str, Enum):
|
|||
ANION = "anion" # Ionizer unit
|
||||
BATTERY_PERCENTAGE = "battery_percentage" # Battery percentage
|
||||
BATTERY_STATE = "battery_state" # Battery state
|
||||
BATTERY_VALUE = "battery_value" # Battery value
|
||||
BRIGHT_CONTROLLER = "bright_controller"
|
||||
BRIGHT_STATE = "bright_state" # Brightness status
|
||||
BRIGHT_VALUE = "bright_value" # Brightness
|
||||
|
@ -144,6 +145,9 @@ class DPCode(str, Enum):
|
|||
CH2O_VALUE = "ch2o_value"
|
||||
CHILD_LOCK = "child_lock" # Child lock
|
||||
CO2_STATE = "co2_state"
|
||||
SMOKE_SENSOR_STATUS = "smoke_sensor_status"
|
||||
SMOKE_SENSOR_STATE = "smoke_sensor_state"
|
||||
SMOKE_SENSOR_VALUE = "smoke_sensor_value"
|
||||
CO2_VALUE = "co2_value" # CO2 concentration
|
||||
COLOR_DATA_V2 = "color_data_v2"
|
||||
COLOUR_DATA = "colour_data" # Colored light mode
|
||||
|
|
|
@ -57,6 +57,13 @@ BATTERY_SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||
icon="mdi:battery",
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=DPCode.BATTERY_VALUE,
|
||||
name="Battery",
|
||||
device_class=DEVICE_CLASS_BATTERY,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
)
|
||||
|
||||
# All descriptions can be found here. Mostly the Integer data types in the
|
||||
|
@ -198,6 +205,18 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
|
|||
# Emergency Button
|
||||
# https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy
|
||||
"sos": BATTERY_SENSORS,
|
||||
# Smoke Detector
|
||||
# https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952
|
||||
"ywbj": (
|
||||
SensorEntityDescription(
|
||||
key=DPCode.SMOKE_SENSOR_VALUE,
|
||||
name="Smoke Amount",
|
||||
icon="mdi:smoke-detector",
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
device_class=STATE_CLASS_MEASUREMENT,
|
||||
),
|
||||
*BATTERY_SENSORS,
|
||||
),
|
||||
# Vibration Sensor
|
||||
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
|
||||
"zd": BATTERY_SENSORS,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue