Add Temperature and Humidity Sensor (wsdcg) device support to Tuya (#58335)

pull/58388/head
Franck Nijhof 2021-10-25 09:19:00 +02:00 committed by GitHub
parent 80b12346d8
commit 35872a212b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View File

@ -191,6 +191,9 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
),
TAMPER_BINARY_SENSOR,
),
# Temperature and Humidity Sensor
# https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34
"wsdcg": (TAMPER_BINARY_SENSOR,),
# Pressure Sensor
# https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
"ylcg": (

View File

@ -295,6 +295,7 @@ class DPCode(str, Enum):
TEMP_VALUE_V2 = "temp_value_v2"
TEMPER_ALARM = "temper_alarm" # Tamper alarm
UV = "uv" # UV sterilization
VA_BATTERY = "va_battery"
VA_HUMIDITY = "va_humidity"
VA_TEMPERATURE = "va_temperature"
VOC_STATE = "voc_state"

View File

@ -68,6 +68,13 @@ BATTERY_SENSORS: tuple[SensorEntityDescription, ...] = (
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
state_class=STATE_CLASS_MEASUREMENT,
),
SensorEntityDescription(
key=DPCode.VA_BATTERY,
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
@ -368,6 +375,41 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
),
*BATTERY_SENSORS,
),
# Temperature and Humidity Sensor
# https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34
"wsdcg": (
SensorEntityDescription(
key=DPCode.VA_TEMPERATURE,
name="Temperature",
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
),
SensorEntityDescription(
key=DPCode.TEMP_CURRENT,
name="Temperature",
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
),
SensorEntityDescription(
key=DPCode.VA_HUMIDITY,
name="Humidity",
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
),
SensorEntityDescription(
key=DPCode.HUMIDITY_VALUE,
name="Humidity",
device_class=DEVICE_CLASS_HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT,
),
SensorEntityDescription(
key=DPCode.BRIGHT_VALUE,
name="Luminosity",
device_class=DEVICE_CLASS_ILLUMINANCE,
state_class=STATE_CLASS_MEASUREMENT,
),
*BATTERY_SENSORS,
),
# Pressure Sensor
# https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
"ylcg": (