Fix Tuya unsupported Temperature & Humidity Sensors (with or without external probe) (#138542)

* add category qxj for th sensor with external probe. partly fixes #136472

* add TEMP_CURRENT_EXTERNAL for th sensor with external probe. fixes #136472

* ruff format

* add translation_key temperature_external for TEMP_CURRENT_EXTERNAL

---------

Co-authored-by: Franck Nijhof <git@frenck.dev>
pull/137215/merge
Maghiel Dijksman 2025-03-02 14:25:19 +01:00 committed by GitHub
parent 5b1f3d3e7f
commit 0694f9e164
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 62 additions and 0 deletions

View File

@ -291,6 +291,9 @@ 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

@ -333,6 +333,12 @@ class DPCode(StrEnum):
TEMP_CONTROLLER = "temp_controller"
TEMP_CURRENT = "temp_current" # Current temperature in °C
TEMP_CURRENT_F = "temp_current_f" # Current temperature in °F
TEMP_CURRENT_EXTERNAL = (
"temp_current_external" # Current external temperature in Celsius
)
TEMP_CURRENT_EXTERNAL_F = (
"temp_current_external_f" # Current external temperature in Fahrenheit
)
TEMP_INDOOR = "temp_indoor" # Indoor temperature in °C
TEMP_SET = "temp_set" # Set the temperature in °C
TEMP_SET_F = "temp_set_f" # Set the temperature in °F

View File

@ -715,6 +715,47 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
),
*BATTERY_SENSORS,
),
# Temperature and Humidity Sensor with External Probe
# New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
"qxj": (
TuyaSensorEntityDescription(
key=DPCode.VA_TEMPERATURE,
translation_key="temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.TEMP_CURRENT,
translation_key="temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.TEMP_CURRENT_EXTERNAL,
translation_key="temperature_external",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.VA_HUMIDITY,
translation_key="humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.HUMIDITY_VALUE,
translation_key="humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
),
TuyaSensorEntityDescription(
key=DPCode.BRIGHT_VALUE,
translation_key="illuminance",
device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
),
*BATTERY_SENSORS,
),
# Pressure Sensor
# https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
"ylcg": (

View File

@ -469,6 +469,9 @@
"temperature": {
"name": "[%key:component::sensor::entity_component::temperature::name%]"
},
"temperature_external": {
"name": "Probe temperature"
},
"humidity": {
"name": "[%key:component::sensor::entity_component::humidity::name%]"
},

View File

@ -612,6 +612,15 @@ 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": (