mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Add Smoke Detector (ywbj) device support to Tuya (#58170)
This commit is contained in:
parent
ea2e94a4e5
commit
3c52bc214d
@ -10,6 +10,7 @@ from homeassistant.components.binary_sensor import (
|
|||||||
DEVICE_CLASS_MOISTURE,
|
DEVICE_CLASS_MOISTURE,
|
||||||
DEVICE_CLASS_MOTION,
|
DEVICE_CLASS_MOTION,
|
||||||
DEVICE_CLASS_SAFETY,
|
DEVICE_CLASS_SAFETY,
|
||||||
|
DEVICE_CLASS_SMOKE,
|
||||||
DEVICE_CLASS_TAMPER,
|
DEVICE_CLASS_TAMPER,
|
||||||
DEVICE_CLASS_VIBRATION,
|
DEVICE_CLASS_VIBRATION,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
@ -98,6 +99,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||||||
device_class=DEVICE_CLASS_TAMPER,
|
device_class=DEVICE_CLASS_TAMPER,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
|
TAMPER_BINARY_SENSOR,
|
||||||
),
|
),
|
||||||
# PIR Detector
|
# PIR Detector
|
||||||
# https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80
|
# https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80
|
||||||
@ -128,6 +130,21 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||||||
),
|
),
|
||||||
TAMPER_BINARY_SENSOR,
|
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
|
# Vibration Sensor
|
||||||
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
|
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
|
||||||
"zd": (
|
"zd": (
|
||||||
|
@ -132,6 +132,7 @@ class DPCode(str, Enum):
|
|||||||
ANION = "anion" # Ionizer unit
|
ANION = "anion" # Ionizer unit
|
||||||
BATTERY_PERCENTAGE = "battery_percentage" # Battery percentage
|
BATTERY_PERCENTAGE = "battery_percentage" # Battery percentage
|
||||||
BATTERY_STATE = "battery_state" # Battery state
|
BATTERY_STATE = "battery_state" # Battery state
|
||||||
|
BATTERY_VALUE = "battery_value" # Battery value
|
||||||
BRIGHT_CONTROLLER = "bright_controller"
|
BRIGHT_CONTROLLER = "bright_controller"
|
||||||
BRIGHT_STATE = "bright_state" # Brightness status
|
BRIGHT_STATE = "bright_state" # Brightness status
|
||||||
BRIGHT_VALUE = "bright_value" # Brightness
|
BRIGHT_VALUE = "bright_value" # Brightness
|
||||||
@ -144,6 +145,9 @@ class DPCode(str, Enum):
|
|||||||
CH2O_VALUE = "ch2o_value"
|
CH2O_VALUE = "ch2o_value"
|
||||||
CHILD_LOCK = "child_lock" # Child lock
|
CHILD_LOCK = "child_lock" # Child lock
|
||||||
CO2_STATE = "co2_state"
|
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
|
CO2_VALUE = "co2_value" # CO2 concentration
|
||||||
COLOR_DATA_V2 = "color_data_v2"
|
COLOR_DATA_V2 = "color_data_v2"
|
||||||
COLOUR_DATA = "colour_data" # Colored light mode
|
COLOUR_DATA = "colour_data" # Colored light mode
|
||||||
|
@ -57,6 +57,13 @@ BATTERY_SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
icon="mdi:battery",
|
icon="mdi:battery",
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
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
|
# All descriptions can be found here. Mostly the Integer data types in the
|
||||||
@ -198,6 +205,18 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
|
|||||||
# Emergency Button
|
# Emergency Button
|
||||||
# https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy
|
# https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy
|
||||||
"sos": BATTERY_SENSORS,
|
"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
|
# Vibration Sensor
|
||||||
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
|
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
|
||||||
"zd": BATTERY_SENSORS,
|
"zd": BATTERY_SENSORS,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user