Sort tuya definitions by category (#148472)

This commit is contained in:
epenet 2025-07-09 10:42:55 +02:00 committed by GitHub
parent cb2095bcbe
commit 13d05a338b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 1068 additions and 1066 deletions

View File

@ -46,6 +46,40 @@ TAMPER_BINARY_SENSOR = TuyaBinarySensorEntityDescription(
# end up being a binary sensor.
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
TuyaBinarySensorEntityDescription(
key=DPCode.CO2_STATE,
device_class=BinarySensorDeviceClass.SAFETY,
on_value="alarm",
),
TAMPER_BINARY_SENSOR,
),
# CO Detector
# https://developer.tuya.com/en/docs/iot/categorycobj?id=Kaiuz3u1j6q1v
"cobj": (
TuyaBinarySensorEntityDescription(
key=DPCode.CO_STATE,
device_class=BinarySensorDeviceClass.SAFETY,
on_value="1",
),
TuyaBinarySensorEntityDescription(
key=DPCode.CO_STATUS,
device_class=BinarySensorDeviceClass.SAFETY,
on_value="alarm",
),
TAMPER_BINARY_SENSOR,
),
# Smart Pet Feeder
# https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld
"cwwsq": (
TuyaBinarySensorEntityDescription(
key=DPCode.FEED_STATE,
translation_key="feeding",
on_value="feeding",
),
),
# Multi-functional Sensor
# https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3
"dgnbj": (
@ -111,40 +145,6 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
),
TAMPER_BINARY_SENSOR,
),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
TuyaBinarySensorEntityDescription(
key=DPCode.CO2_STATE,
device_class=BinarySensorDeviceClass.SAFETY,
on_value="alarm",
),
TAMPER_BINARY_SENSOR,
),
# CO Detector
# https://developer.tuya.com/en/docs/iot/categorycobj?id=Kaiuz3u1j6q1v
"cobj": (
TuyaBinarySensorEntityDescription(
key=DPCode.CO_STATE,
device_class=BinarySensorDeviceClass.SAFETY,
on_value="1",
),
TuyaBinarySensorEntityDescription(
key=DPCode.CO_STATUS,
device_class=BinarySensorDeviceClass.SAFETY,
on_value="alarm",
),
TAMPER_BINARY_SENSOR,
),
# Smart Pet Feeder
# https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld
"cwwsq": (
TuyaBinarySensorEntityDescription(
key=DPCode.FEED_STATE,
translation_key="feeding",
on_value="feeding",
),
),
# Human Presence Sensor
# https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs
"hps": (
@ -174,6 +174,16 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
),
TAMPER_BINARY_SENSOR,
),
# Luminance Sensor
# https://developer.tuya.com/en/docs/iot/categoryldcg?id=Kaiuz3n7u69l8
"ldcg": (
TuyaBinarySensorEntityDescription(
key=DPCode.TEMPER_ALARM,
device_class=BinarySensorDeviceClass.TAMPER,
entity_category=EntityCategory.DIAGNOSTIC,
),
TAMPER_BINARY_SENSOR,
),
# Door and Window Controller
# https://developer.tuya.com/en/docs/iot/s?id=K9gf48r5zjsy9
"mc": (
@ -205,16 +215,6 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
on_value={"AQAB"},
),
),
# Luminance Sensor
# https://developer.tuya.com/en/docs/iot/categoryldcg?id=Kaiuz3n7u69l8
"ldcg": (
TuyaBinarySensorEntityDescription(
key=DPCode.TEMPER_ALARM,
device_class=BinarySensorDeviceClass.TAMPER,
entity_category=EntityCategory.DIAGNOSTIC,
),
TAMPER_BINARY_SENSOR,
),
# PIR Detector
# https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80
"pir": (
@ -235,6 +235,9 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
),
TAMPER_BINARY_SENSOR,
),
# Temperature and Humidity Sensor with External Probe
# New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
"qxj": (TAMPER_BINARY_SENSOR,),
# Gas Detector
# https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw
"rqbj": (
@ -291,9 +294,6 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = {
# Temperature and Humidity Sensor
# https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34
"wsdcg": (TAMPER_BINARY_SENSOR,),
# Temperature and Humidity Sensor with External Probe
# New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
"qxj": (TAMPER_BINARY_SENSOR,),
# Pressure Sensor
# https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
"ylcg": (

View File

@ -17,6 +17,14 @@ from .entity import TuyaEntity
# All descriptions can be found here.
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = {
# Wake Up Light II
# Not documented
"hxd": (
ButtonEntityDescription(
key=DPCode.SWITCH_USB6,
translation_key="snooze",
),
),
# Robot Vacuum
# https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo
"sd": (
@ -46,14 +54,6 @@ BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Wake Up Light II
# Not documented
"hxd": (
ButtonEntityDescription(
key=DPCode.SWITCH_USB6,
translation_key="snooze",
),
),
}

View File

@ -17,12 +17,12 @@ from .entity import TuyaEntity
# All descriptions can be found here:
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
CAMERAS: tuple[str, ...] = (
# Smart Camera (including doorbells)
# https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu
"sp",
# Smart Camera - Low power consumption camera
# Undocumented, see https://github.com/home-assistant/core/issues/132844
"dghsxj",
# Smart Camera (including doorbells)
# https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu
"sp",
)

View File

@ -47,6 +47,12 @@ class TuyaClimateEntityDescription(ClimateEntityDescription):
CLIMATE_DESCRIPTIONS: dict[str, TuyaClimateEntityDescription] = {
# Electric Fireplace
# https://developer.tuya.com/en/docs/iot/f?id=Kacpeobojffop
"dbl": TuyaClimateEntityDescription(
key="dbl",
switch_only_hvac_mode=HVACMode.HEAT,
),
# Air conditioner
# https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n
"kt": TuyaClimateEntityDescription(
@ -77,9 +83,6 @@ CLIMATE_DESCRIPTIONS: dict[str, TuyaClimateEntityDescription] = {
key="wkf",
switch_only_hvac_mode=HVACMode.HEAT,
),
# Electric Fireplace
# https://developer.tuya.com/en/docs/iot/f?id=Kacpeobojffop
"dbl": TuyaClimateEntityDescription(key="dbl", switch_only_hvac_mode=HVACMode.HEAT),
}

View File

@ -38,6 +38,31 @@ class TuyaCoverEntityDescription(CoverEntityDescription):
COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
# Garage Door Opener
# https://developer.tuya.com/en/docs/iot/categoryckmkzq?id=Kaiuz0ipcboee
"ckmkzq": (
TuyaCoverEntityDescription(
key=DPCode.SWITCH_1,
translation_key="door",
current_state=DPCode.DOORCONTACT_STATE,
current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE,
),
TuyaCoverEntityDescription(
key=DPCode.SWITCH_2,
translation_key="door_2",
current_state=DPCode.DOORCONTACT_STATE_2,
current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE,
),
TuyaCoverEntityDescription(
key=DPCode.SWITCH_3,
translation_key="door_3",
current_state=DPCode.DOORCONTACT_STATE_3,
current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE,
),
),
# Curtain
# Note: Multiple curtains isn't documented
# https://developer.tuya.com/en/docs/iot/categorycl?id=Kaiuz1hnpo7df
@ -84,31 +109,6 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
device_class=CoverDeviceClass.BLIND,
),
),
# Garage Door Opener
# https://developer.tuya.com/en/docs/iot/categoryckmkzq?id=Kaiuz0ipcboee
"ckmkzq": (
TuyaCoverEntityDescription(
key=DPCode.SWITCH_1,
translation_key="door",
current_state=DPCode.DOORCONTACT_STATE,
current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE,
),
TuyaCoverEntityDescription(
key=DPCode.SWITCH_2,
translation_key="door_2",
current_state=DPCode.DOORCONTACT_STATE_2,
current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE,
),
TuyaCoverEntityDescription(
key=DPCode.SWITCH_3,
translation_key="door_3",
current_state=DPCode.DOORCONTACT_STATE_3,
current_state_inverse=True,
device_class=CoverDeviceClass.GARAGE,
),
),
# Curtain Switch
# https://developer.tuya.com/en/docs/iot/category-clkg?id=Kaiuz0gitil39
"clkg": (

View File

@ -25,11 +25,11 @@ from .const import TUYA_DISCOVERY_NEW, DPCode, DPType
from .entity import EnumTypeData, IntegerTypeData, TuyaEntity
TUYA_SUPPORT_TYPE = {
"cs", # Dehumidifier
"fs", # Fan
"fsd", # Fan with Light
"fskg", # Fan wall switch
"kj", # Air Purifier
"cs", # Dehumidifier
}

View File

@ -135,6 +135,22 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
brightness=DPCode.BRIGHT_VALUE,
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c
"fs": (
TuyaLightEntityDescription(
key=DPCode.LIGHT,
name=None,
color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE,
),
TuyaLightEntityDescription(
key=DPCode.SWITCH_LED,
translation_key="light_2",
brightness=DPCode.BRIGHT_VALUE_1,
),
),
# Ceiling Fan Light
# https://developer.tuya.com/en/docs/iot/fsd?id=Kaof8eiei4c2v
"fsd": (
@ -176,6 +192,17 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
color_data=DPCode.COLOUR_DATA,
),
),
# Wake Up Light II
# Not documented
"hxd": (
TuyaLightEntityDescription(
key=DPCode.SWITCH_LED,
translation_key="light",
brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE),
brightness_max=DPCode.BRIGHTNESS_MAX_1,
brightness_min=DPCode.BRIGHTNESS_MIN_1,
),
),
# Humidifier Light
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
"jsq": (
@ -316,17 +343,6 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
brightness=DPCode.BRIGHT_VALUE_2,
),
),
# Wake Up Light II
# Not documented
"hxd": (
TuyaLightEntityDescription(
key=DPCode.SWITCH_LED,
translation_key="light",
brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE),
brightness_max=DPCode.BRIGHTNESS_MAX_1,
brightness_min=DPCode.BRIGHTNESS_MIN_1,
),
),
# Outdoor Flood Light
# Not documented
"tyd": (
@ -378,22 +394,6 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = {
color_temp=DPCode.TEMP_CONTROLLER,
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c
"fs": (
TuyaLightEntityDescription(
key=DPCode.LIGHT,
name=None,
color_mode=DPCode.WORK_MODE,
brightness=DPCode.BRIGHT_VALUE,
color_temp=DPCode.TEMP_VALUE,
),
TuyaLightEntityDescription(
key=DPCode.SWITCH_LED,
translation_key="light_2",
brightness=DPCode.BRIGHT_VALUE_1,
),
),
}
# Socket (duplicate of `kg`)

View File

@ -22,15 +22,6 @@ from .entity import IntegerTypeData, TuyaEntity
# default instructions set of each category end up being a number.
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
# Multi-functional Sensor
# https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3
"dgnbj": (
NumberEntityDescription(
key=DPCode.ALARM_TIME,
translation_key="time",
entity_category=EntityCategory.CONFIG,
),
),
# Smart Kettle
# https://developer.tuya.com/en/docs/iot/fbh?id=K9gf484m21yq7
"bh": (
@ -64,6 +55,17 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
NumberEntityDescription(
key=DPCode.ALARM_TIME,
translation_key="alarm_duration",
native_unit_of_measurement=UnitOfTime.SECONDS,
device_class=NumberDeviceClass.DURATION,
entity_category=EntityCategory.CONFIG,
),
),
# Smart Pet Feeder
# https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld
"cwwsq": (
@ -76,6 +78,24 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
translation_key="voice_times",
),
),
# Multi-functional Sensor
# https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3
"dgnbj": (
NumberEntityDescription(
key=DPCode.ALARM_TIME,
translation_key="time",
entity_category=EntityCategory.CONFIG,
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c
"fs": (
NumberEntityDescription(
key=DPCode.TEMP,
translation_key="temperature",
device_class=NumberDeviceClass.TEMPERATURE,
),
),
# Human Presence Sensor
# https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs
"hps": (
@ -102,6 +122,20 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
device_class=NumberDeviceClass.DISTANCE,
),
),
# Humidifier
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
"jsq": (
NumberEntityDescription(
key=DPCode.TEMP_SET,
translation_key="temperature",
device_class=NumberDeviceClass.TEMPERATURE,
),
NumberEntityDescription(
key=DPCode.TEMP_SET_F,
translation_key="temperature",
device_class=NumberDeviceClass.TEMPERATURE,
),
),
# Coffee maker
# https://developer.tuya.com/en/docs/iot/categorykfj?id=Kaiuz2p12pc7f
"kfj": (
@ -174,6 +208,26 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Fingerbot
"szjqr": (
NumberEntityDescription(
key=DPCode.ARM_DOWN_PERCENT,
translation_key="move_down",
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.ARM_UP_PERCENT,
translation_key="move_up",
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.CLICK_SUSTAIN_TIME,
translation_key="down_delay",
entity_category=EntityCategory.CONFIG,
),
),
# Dimmer Switch
# https://developer.tuya.com/en/docs/iot/categorytgkg?id=Kaiuz0ktx7m0o
"tgkg": (
@ -241,49 +295,6 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Fingerbot
"szjqr": (
NumberEntityDescription(
key=DPCode.ARM_DOWN_PERCENT,
translation_key="move_down",
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.ARM_UP_PERCENT,
translation_key="move_up",
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=DPCode.CLICK_SUSTAIN_TIME,
translation_key="down_delay",
entity_category=EntityCategory.CONFIG,
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c
"fs": (
NumberEntityDescription(
key=DPCode.TEMP,
translation_key="temperature",
device_class=NumberDeviceClass.TEMPERATURE,
),
),
# Humidifier
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
"jsq": (
NumberEntityDescription(
key=DPCode.TEMP_SET,
translation_key="temperature",
device_class=NumberDeviceClass.TEMPERATURE,
),
NumberEntityDescription(
key=DPCode.TEMP_SET_F,
translation_key="temperature",
device_class=NumberDeviceClass.TEMPERATURE,
),
),
# Pool HeatPump
"znrb": (
NumberEntityDescription(
@ -292,17 +303,6 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
device_class=NumberDeviceClass.TEMPERATURE,
),
),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
NumberEntityDescription(
key=DPCode.ALARM_TIME,
translation_key="alarm_duration",
native_unit_of_measurement=UnitOfTime.SECONDS,
device_class=NumberDeviceClass.DURATION,
entity_category=EntityCategory.CONFIG,
),
),
}
# Smart Camera - Low power consumption camera (duplicate of `sp`)

View File

@ -18,6 +18,43 @@ from .entity import TuyaEntity
# default instructions set of each category end up being a select.
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
# Curtain
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc
"cl": (
SelectEntityDescription(
key=DPCode.CONTROL_BACK_MODE,
entity_category=EntityCategory.CONFIG,
translation_key="curtain_motor_mode",
),
SelectEntityDescription(
key=DPCode.MODE,
entity_category=EntityCategory.CONFIG,
translation_key="curtain_mode",
),
),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
SelectEntityDescription(
key=DPCode.ALARM_VOLUME,
translation_key="volume",
entity_category=EntityCategory.CONFIG,
),
),
# Dehumidifier
# https://developer.tuya.com/en/docs/iot/categorycs?id=Kaiuz1vcz4dha
"cs": (
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.DEHUMIDITY_SET_ENUM,
translation_key="target_humidity",
entity_category=EntityCategory.CONFIG,
),
),
# Multi-functional Sensor
# https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3
"dgnbj": (
@ -27,6 +64,81 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Electric Blanket
# https://developer.tuya.com/en/docs/iot/categorydr?id=Kaiuz22dyc66p
"dr": (
SelectEntityDescription(
key=DPCode.LEVEL,
name="Level",
icon="mdi:thermometer-lines",
translation_key="blanket_level",
),
SelectEntityDescription(
key=DPCode.LEVEL_1,
name="Side A Level",
icon="mdi:thermometer-lines",
translation_key="blanket_level",
),
SelectEntityDescription(
key=DPCode.LEVEL_2,
name="Side B Level",
icon="mdi:thermometer-lines",
translation_key="blanket_level",
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/f?id=K9gf45vs7vkge
"fs": (
SelectEntityDescription(
key=DPCode.FAN_VERTICAL,
entity_category=EntityCategory.CONFIG,
translation_key="vertical_fan_angle",
),
SelectEntityDescription(
key=DPCode.FAN_HORIZONTAL,
entity_category=EntityCategory.CONFIG,
translation_key="horizontal_fan_angle",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
),
# Humidifier
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
"jsq": (
SelectEntityDescription(
key=DPCode.SPRAY_MODE,
entity_category=EntityCategory.CONFIG,
translation_key="humidifier_spray_mode",
),
SelectEntityDescription(
key=DPCode.LEVEL,
entity_category=EntityCategory.CONFIG,
translation_key="humidifier_level",
),
SelectEntityDescription(
key=DPCode.MOODLIGHTING,
entity_category=EntityCategory.CONFIG,
translation_key="humidifier_moodlighting",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
),
# Coffee maker
# https://developer.tuya.com/en/docs/iot/categorykfj?id=Kaiuz2p12pc7f
"kfj": (
@ -63,6 +175,20 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
translation_key="light_mode",
),
),
# Air Purifier
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46h2s6dzm
"kj": (
SelectEntityDescription(
key=DPCode.COUNTDOWN,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
),
# Heater
# https://developer.tuya.com/en/docs/iot/categoryqn?id=Kaiuz18kih0sm
"qn": (
@ -71,6 +197,25 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
translation_key="temperature_level",
),
),
# Robot Vacuum
# https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo
"sd": (
SelectEntityDescription(
key=DPCode.CISTERN,
entity_category=EntityCategory.CONFIG,
translation_key="vacuum_cistern",
),
SelectEntityDescription(
key=DPCode.COLLECTION_MODE,
entity_category=EntityCategory.CONFIG,
translation_key="vacuum_collection",
),
SelectEntityDescription(
key=DPCode.MODE,
entity_category=EntityCategory.CONFIG,
translation_key="vacuum_mode",
),
),
# Smart Water Timer
"sfkzq": (
# Irrigation will not be run within this set delay period
@ -128,6 +273,14 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
translation_key="motion_sensitivity",
),
),
# Fingerbot
"szjqr": (
SelectEntityDescription(
key=DPCode.MODE,
entity_category=EntityCategory.CONFIG,
translation_key="fingerbot_mode",
),
),
# IoT Switch?
# Note: Undocumented
"tdq": (
@ -185,173 +338,20 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = {
translation_key="led_type_2",
),
),
# Fingerbot
"szjqr": (
SelectEntityDescription(
key=DPCode.MODE,
entity_category=EntityCategory.CONFIG,
translation_key="fingerbot_mode",
),
),
# Robot Vacuum
# https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo
"sd": (
SelectEntityDescription(
key=DPCode.CISTERN,
entity_category=EntityCategory.CONFIG,
translation_key="vacuum_cistern",
),
SelectEntityDescription(
key=DPCode.COLLECTION_MODE,
entity_category=EntityCategory.CONFIG,
translation_key="vacuum_collection",
),
SelectEntityDescription(
key=DPCode.MODE,
entity_category=EntityCategory.CONFIG,
translation_key="vacuum_mode",
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/f?id=K9gf45vs7vkge
"fs": (
SelectEntityDescription(
key=DPCode.FAN_VERTICAL,
entity_category=EntityCategory.CONFIG,
translation_key="vertical_fan_angle",
),
SelectEntityDescription(
key=DPCode.FAN_HORIZONTAL,
entity_category=EntityCategory.CONFIG,
translation_key="horizontal_fan_angle",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
),
# Curtain
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc
"cl": (
SelectEntityDescription(
key=DPCode.CONTROL_BACK_MODE,
entity_category=EntityCategory.CONFIG,
translation_key="curtain_motor_mode",
),
SelectEntityDescription(
key=DPCode.MODE,
entity_category=EntityCategory.CONFIG,
translation_key="curtain_mode",
),
),
# Humidifier
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
"jsq": (
SelectEntityDescription(
key=DPCode.SPRAY_MODE,
entity_category=EntityCategory.CONFIG,
translation_key="humidifier_spray_mode",
),
SelectEntityDescription(
key=DPCode.LEVEL,
entity_category=EntityCategory.CONFIG,
translation_key="humidifier_level",
),
SelectEntityDescription(
key=DPCode.MOODLIGHTING,
entity_category=EntityCategory.CONFIG,
translation_key="humidifier_moodlighting",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
),
# Air Purifier
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46h2s6dzm
"kj": (
SelectEntityDescription(
key=DPCode.COUNTDOWN,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
),
# Dehumidifier
# https://developer.tuya.com/en/docs/iot/categorycs?id=Kaiuz1vcz4dha
"cs": (
SelectEntityDescription(
key=DPCode.COUNTDOWN_SET,
entity_category=EntityCategory.CONFIG,
translation_key="countdown",
),
SelectEntityDescription(
key=DPCode.DEHUMIDITY_SET_ENUM,
translation_key="target_humidity",
entity_category=EntityCategory.CONFIG,
),
),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
SelectEntityDescription(
key=DPCode.ALARM_VOLUME,
translation_key="volume",
entity_category=EntityCategory.CONFIG,
),
),
# Electric Blanket
# https://developer.tuya.com/en/docs/iot/categorydr?id=Kaiuz22dyc66p
"dr": (
SelectEntityDescription(
key=DPCode.LEVEL,
name="Level",
icon="mdi:thermometer-lines",
translation_key="blanket_level",
),
SelectEntityDescription(
key=DPCode.LEVEL_1,
name="Side A Level",
icon="mdi:thermometer-lines",
translation_key="blanket_level",
),
SelectEntityDescription(
key=DPCode.LEVEL_2,
name="Side B Level",
icon="mdi:thermometer-lines",
translation_key="blanket_level",
),
),
}
# Socket (duplicate of `kg`)
# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s
SELECTS["cz"] = SELECTS["kg"]
# Power Socket (duplicate of `kg`)
# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s
SELECTS["pc"] = SELECTS["kg"]
# Smart Camera - Low power consumption camera (duplicate of `sp`)
# Undocumented, see https://github.com/home-assistant/core/issues/132844
SELECTS["dghsxj"] = SELECTS["sp"]
# Power Socket (duplicate of `kg`)
# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s
SELECTS["pc"] = SELECTS["kg"]
async def async_setup_entry(
hass: HomeAssistant,

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,14 @@ from .entity import TuyaEntity
# All descriptions can be found here:
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = {
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
SirenEntityDescription(
key=DPCode.ALARM_SWITCH,
entity_category=EntityCategory.CONFIG,
),
),
# Multi-functional Sensor
# https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3
"dgnbj": (
@ -44,14 +52,6 @@ SIRENS: dict[str, tuple[SirenEntityDescription, ...]] = {
key=DPCode.SIREN_SWITCH,
),
),
# CO2 Detector
# https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy
"co2bj": (
SirenEntityDescription(
key=DPCode.ALARM_SWITCH,
entity_category=EntityCategory.CONFIG,
),
),
}
# Smart Camera - Low power consumption camera (duplicate of `sp`)

View File

@ -37,6 +37,20 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Curtain
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc
"cl": (
SwitchEntityDescription(
key=DPCode.CONTROL_BACK,
translation_key="reverse",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.OPPOSITE,
translation_key="reverse",
entity_category=EntityCategory.CONFIG,
),
),
# EasyBaby
# Undocumented, might have a wider use
"cn": (
@ -131,6 +145,116 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
translation_key="switch",
),
),
# Electric Blanket
# https://developer.tuya.com/en/docs/iot/categorydr?id=Kaiuz22dyc66p
"dr": (
SwitchEntityDescription(
key=DPCode.SWITCH,
name="Power",
icon="mdi:power",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.SWITCH_1,
name="Side A Power",
icon="mdi:alpha-a",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.SWITCH_2,
name="Side B Power",
icon="mdi:alpha-b",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.PREHEAT,
name="Preheat",
icon="mdi:radiator",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.PREHEAT_1,
name="Side A Preheat",
icon="mdi:radiator",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.PREHEAT_2,
name="Side B Preheat",
icon="mdi:radiator",
device_class=SwitchDeviceClass.SWITCH,
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c
"fs": (
SwitchEntityDescription(
key=DPCode.ANION,
translation_key="anion",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.HUMIDIFIER,
translation_key="humidification",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.OXYGEN,
translation_key="oxygen_bar",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.FAN_COOL,
translation_key="natural_wind",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.FAN_BEEP,
translation_key="sound",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.CHILD_LOCK,
translation_key="child_lock",
entity_category=EntityCategory.CONFIG,
),
),
# Irrigator
# https://developer.tuya.com/en/docs/iot/categoryggq?id=Kaiuz1qib7z0k
"ggq": (
SwitchEntityDescription(
key=DPCode.SWITCH_1,
translation_key="switch_1",
),
SwitchEntityDescription(
key=DPCode.SWITCH_2,
translation_key="switch_2",
),
SwitchEntityDescription(
key=DPCode.SWITCH_3,
translation_key="switch_3",
),
SwitchEntityDescription(
key=DPCode.SWITCH_4,
translation_key="switch_4",
),
SwitchEntityDescription(
key=DPCode.SWITCH_5,
translation_key="switch_5",
),
SwitchEntityDescription(
key=DPCode.SWITCH_6,
translation_key="switch_6",
),
SwitchEntityDescription(
key=DPCode.SWITCH_7,
translation_key="switch_7",
),
SwitchEntityDescription(
key=DPCode.SWITCH_8,
translation_key="switch_8",
),
),
# Wake Up Light II
# Not documented
"hxd": (
@ -163,19 +287,23 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
translation_key="sleep_aid",
),
),
# Two-way temperature and humidity switch
# "MOES Temperature and Humidity Smart Switch Module MS-103"
# Documentation not found
"wkcz": (
# Humidifier
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
"jsq": (
SwitchEntityDescription(
key=DPCode.SWITCH_1,
translation_key="switch_1",
device_class=SwitchDeviceClass.OUTLET,
key=DPCode.SWITCH_SOUND,
translation_key="voice",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.SWITCH_2,
translation_key="switch_2",
device_class=SwitchDeviceClass.OUTLET,
key=DPCode.SLEEP,
translation_key="sleep",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.STERILIZATION,
translation_key="sterilization",
entity_category=EntityCategory.CONFIG,
),
),
# Switch
@ -408,6 +536,15 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# SIREN: Siren (switch) with Temperature and Humidity Sensor with External Probe
# New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
"qxj": (
SwitchEntityDescription(
key=DPCode.SWITCH,
translation_key="switch",
device_class=SwitchDeviceClass.OUTLET,
),
),
# Robot Vacuum
# https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo
"sd": (
@ -429,42 +566,6 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
translation_key="switch",
),
),
# Irrigator
# https://developer.tuya.com/en/docs/iot/categoryggq?id=Kaiuz1qib7z0k
"ggq": (
SwitchEntityDescription(
key=DPCode.SWITCH_1,
translation_key="switch_1",
),
SwitchEntityDescription(
key=DPCode.SWITCH_2,
translation_key="switch_2",
),
SwitchEntityDescription(
key=DPCode.SWITCH_3,
translation_key="switch_3",
),
SwitchEntityDescription(
key=DPCode.SWITCH_4,
translation_key="switch_4",
),
SwitchEntityDescription(
key=DPCode.SWITCH_5,
translation_key="switch_5",
),
SwitchEntityDescription(
key=DPCode.SWITCH_6,
translation_key="switch_6",
),
SwitchEntityDescription(
key=DPCode.SWITCH_7,
translation_key="switch_7",
),
SwitchEntityDescription(
key=DPCode.SWITCH_8,
translation_key="switch_8",
),
),
# Siren Alarm
# https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu
"sgbj": (
@ -552,13 +653,6 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
translation_key="switch",
),
),
# Hejhome whitelabel Fingerbot
"znjxs": (
SwitchEntityDescription(
key=DPCode.SWITCH,
translation_key="switch",
),
),
# IoT Switch?
# Note: Undocumented
"tdq": (
@ -606,6 +700,21 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
),
),
# Two-way temperature and humidity switch
# "MOES Temperature and Humidity Smart Switch Module MS-103"
# Documentation not found
"wkcz": (
SwitchEntityDescription(
key=DPCode.SWITCH_1,
translation_key="switch_1",
device_class=SwitchDeviceClass.OUTLET,
),
SwitchEntityDescription(
key=DPCode.SWITCH_2,
translation_key="switch_2",
device_class=SwitchDeviceClass.OUTLET,
),
),
# Thermostatic Radiator Valve
# Not documented
"wkf": (
@ -636,15 +745,6 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
device_class=SwitchDeviceClass.OUTLET,
),
),
# SIREN: Siren (switch) with Temperature and Humidity Sensor with External Probe
# New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
"qxj": (
SwitchEntityDescription(
key=DPCode.SWITCH,
translation_key="switch",
device_class=SwitchDeviceClass.OUTLET,
),
),
# Ceiling Light
# https://developer.tuya.com/en/docs/iot/ceiling-light?id=Kaiuz03xxfc4r
"xdd": (
@ -679,71 +779,11 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
translation_key="switch",
),
),
# Fan
# https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c
"fs": (
# Hejhome whitelabel Fingerbot
"znjxs": (
SwitchEntityDescription(
key=DPCode.ANION,
translation_key="anion",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.HUMIDIFIER,
translation_key="humidification",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.OXYGEN,
translation_key="oxygen_bar",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.FAN_COOL,
translation_key="natural_wind",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.FAN_BEEP,
translation_key="sound",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.CHILD_LOCK,
translation_key="child_lock",
entity_category=EntityCategory.CONFIG,
),
),
# Curtain
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc
"cl": (
SwitchEntityDescription(
key=DPCode.CONTROL_BACK,
translation_key="reverse",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.OPPOSITE,
translation_key="reverse",
entity_category=EntityCategory.CONFIG,
),
),
# Humidifier
# https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b
"jsq": (
SwitchEntityDescription(
key=DPCode.SWITCH_SOUND,
translation_key="voice",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.SLEEP,
translation_key="sleep",
entity_category=EntityCategory.CONFIG,
),
SwitchEntityDescription(
key=DPCode.STERILIZATION,
translation_key="sterilization",
entity_category=EntityCategory.CONFIG,
key=DPCode.SWITCH,
translation_key="switch",
),
),
# Pool HeatPump
@ -753,46 +793,6 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = {
translation_key="switch",
),
),
# Electric Blanket
# https://developer.tuya.com/en/docs/iot/categorydr?id=Kaiuz22dyc66p
"dr": (
SwitchEntityDescription(
key=DPCode.SWITCH,
name="Power",
icon="mdi:power",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.SWITCH_1,
name="Side A Power",
icon="mdi:alpha-a",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.SWITCH_2,
name="Side B Power",
icon="mdi:alpha-b",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.PREHEAT,
name="Preheat",
icon="mdi:radiator",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.PREHEAT_1,
name="Side A Preheat",
icon="mdi:radiator",
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key=DPCode.PREHEAT_2,
name="Side B Preheat",
icon="mdi:radiator",
device_class=SwitchDeviceClass.SWITCH,
),
),
}
# Socket (duplicate of `pc`)