Add Vibration Sensor (zd) device support to Tuya (#57795)

This commit is contained in:
Franck Nijhof 2021-10-17 20:56:15 +02:00 committed by GitHub
parent f390812183
commit 4fd8b27ce6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 10 deletions

View file

@ -53,11 +53,13 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_BATTERY,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
SensorEntityDescription(
key=DPCode.BATTERY_STATE,
name="Battery State",
entity_registry_enabled_default=False,
icon="mdi:battery",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
),
# Switch
@ -146,6 +148,25 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
SensorEntityDescription(
key=DPCode.BATTERY_STATE,
name="Battery State",
icon="mdi:battery",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
),
# Vibration Sensor
# https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno
"zd": (
SensorEntityDescription(
key=DPCode.BATTERY_PERCENTAGE,
name="Battery",
native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_BATTERY,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
SensorEntityDescription(
key=DPCode.BATTERY_STATE,
name="Battery State",
icon="mdi:battery",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
),