Add Smoke Detector (ywbj) device support to Tuya (#58170)

This commit is contained in:
Regev Brody 2021-10-22 15:18:01 +03:00 committed by GitHub
parent ea2e94a4e5
commit 3c52bc214d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 0 deletions

View file

@ -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,