Add Gas Detector (rqbj) device support to Tuya (#58293)

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

View File

@ -7,6 +7,7 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_DOOR,
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_SAFETY,
@ -126,6 +127,21 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
),
TAMPER_BINARY_SENSOR,
),
# Gas Detector
# https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw
"rqbj": (
TuyaBinarySensorEntityDescription(
key=DPCode.GAS_SENSOR_STATUS,
device_class=DEVICE_CLASS_GAS,
on_value="alarm",
),
TuyaBinarySensorEntityDescription(
key=DPCode.GAS_SENSOR_STATE,
device_class=DEVICE_CLASS_GAS,
on_value="1",
),
TAMPER_BINARY_SENSOR,
),
# Water Detector
# https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli
"sj": (

View File

@ -177,6 +177,9 @@ class DPCode(str, Enum):
FAN_SPEED_PERCENT = "fan_speed_percent" # Stepless speed
FAR_DETECTION = "far_detection"
FILTER_RESET = "filter_reset" # Filter (cartridge) reset
GAS_SENSOR_STATE = "gas_sensor_state"
GAS_SENSOR_STATUS = "gas_sensor_status"
GAS_SENSOR_VALUE = "gas_sensor_value"
HUMIDITY_CURRENT = "humidity_current" # Current humidity
HUMIDITY_SET = "humidity_set" # Humidity setting
HUMIDITY_VALUE = "humidity_value" # Humidity

View File

@ -211,6 +211,16 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
# PIR Detector
# https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80
"pir": BATTERY_SENSORS,
# Gas Detector
# https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw
"rqbj": (
SensorEntityDescription(
key=DPCode.GAS_SENSOR_VALUE,
icon="mdi:gas-cylinder",
device_class=STATE_CLASS_MEASUREMENT,
),
*BATTERY_SENSORS,
),
# Water Detector
# https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli
"sj": BATTERY_SENSORS,