Add CO2 Detector (co2bj) device support to Tuya (#58093)
This commit is contained in:
parent
b3117ced75
commit
c75346addc
3 changed files with 50 additions and 27 deletions
|
@ -37,11 +37,30 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription):
|
|||
on_value: bool | float | int | str = True
|
||||
|
||||
|
||||
# Commonly used sensors
|
||||
TAMPER_BINARY_SENSOR = TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.TEMPER_ALARM,
|
||||
name="Tamper",
|
||||
device_class=DEVICE_CLASS_TAMPER,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
)
|
||||
|
||||
|
||||
# All descriptions can be found here. Mostly the Boolean data types in the
|
||||
# default status set of each category (that don't have a set instruction)
|
||||
# end up being a binary sensor.
|
||||
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
|
||||
BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
||||
# CO2 Detector
|
||||
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
|
||||
"co2bj": (
|
||||
TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.CO2_STATE,
|
||||
device_class=DEVICE_CLASS_SAFETY,
|
||||
on_value="alarm",
|
||||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# Human Presence Sensor
|
||||
# https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs
|
||||
"hps": (
|
||||
|
@ -58,12 +77,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||
key=DPCode.DOORCONTACT_STATE,
|
||||
device_class=DEVICE_CLASS_DOOR,
|
||||
),
|
||||
TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.TEMPER_ALARM,
|
||||
name="Tamper",
|
||||
device_class=DEVICE_CLASS_TAMPER,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# Luminance Sensor
|
||||
# https://developer.tuya.com/en/docs/iot/categoryldcg?id=Kaiuz3n7u69l8
|
||||
|
@ -83,12 +97,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||
device_class=DEVICE_CLASS_MOTION,
|
||||
on_value="pir",
|
||||
),
|
||||
TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.TEMPER_ALARM,
|
||||
name="Tamper",
|
||||
device_class=DEVICE_CLASS_TAMPER,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# Water Detector
|
||||
# https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli
|
||||
|
@ -98,12 +107,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||
device_class=DEVICE_CLASS_MOISTURE,
|
||||
on_value="alarm",
|
||||
),
|
||||
TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.TEMPER_ALARM,
|
||||
name="Tamper",
|
||||
device_class=DEVICE_CLASS_TAMPER,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# Emergency Button
|
||||
# https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy
|
||||
|
@ -112,12 +116,7 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
|
|||
key=DPCode.SOS_STATE,
|
||||
device_class=DEVICE_CLASS_SAFETY,
|
||||
),
|
||||
TuyaBinarySensorEntityDescription(
|
||||
key=DPCode.TEMPER_ALARM,
|
||||
name="Tamper",
|
||||
device_class=DEVICE_CLASS_TAMPER,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
),
|
||||
TAMPER_BINARY_SENSOR,
|
||||
),
|
||||
# Vibration Sensor
|
||||
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue