Add Pressure Sensor (ylcg) device support to Tuya (#58294)

This commit is contained in:
Franck Nijhof 2021-10-23 18:16:28 +02:00 committed by GitHub
parent 3cdfb84b79
commit 7d0fc8ca98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View file

@ -161,6 +161,15 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
), ),
TAMPER_BINARY_SENSOR, TAMPER_BINARY_SENSOR,
), ),
# Pressure Sensor
# https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
"ylcg": (
TuyaBinarySensorEntityDescription(
key=DPCode.PRESSURE_STATE,
on_value="alarm",
),
TAMPER_BINARY_SENSOR,
),
# Smoke Detector # Smoke Detector
# https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952 # https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952
"ywbj": ( "ywbj": (

View file

@ -206,6 +206,8 @@ class DPCode(str, Enum):
POWDER_SET = "powder_set" # Powder POWDER_SET = "powder_set" # Powder
POWER_GO = "power_go" POWER_GO = "power_go"
PRESENCE_STATE = "presence_state" PRESENCE_STATE = "presence_state"
PRESSURE_STATE = "pressure_state"
PRESSURE_VALUE = "pressure_value"
PUMP_RESET = "pump_reset" # Water pump reset PUMP_RESET = "pump_reset" # Water pump reset
RECORD_SWITCH = "record_switch" # Recording switch RECORD_SWITCH = "record_switch" # Recording switch
RELAY_STATUS = "relay_status" RELAY_STATUS = "relay_status"

View file

@ -21,6 +21,7 @@ from homeassistant.const import (
DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_PM25, DEVICE_CLASS_PM25,
DEVICE_CLASS_POWER, DEVICE_CLASS_POWER,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS, DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
DEVICE_CLASS_VOLTAGE, DEVICE_CLASS_VOLTAGE,
@ -227,6 +228,16 @@ 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,
# Pressure Sensor
# https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
"ylcg": (
SensorEntityDescription(
key=DPCode.PRESSURE_VALUE,
device_class=DEVICE_CLASS_PRESSURE,
state_class=STATE_CLASS_MEASUREMENT,
),
*BATTERY_SENSORS,
),
# Smoke Detector # Smoke Detector
# https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952 # https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952
"ywbj": ( "ywbj": (