diff --git a/homeassistant/components/awair/const.py b/homeassistant/components/awair/const.py index a1c5781e9a421..10f7cb115dab6 100644 --- a/homeassistant/components/awair/const.py +++ b/homeassistant/components/awair/const.py @@ -6,6 +6,7 @@ import logging API_CO2 = "carbon_dioxide" +API_DEW_POINT = "dew_point" API_DUST = "dust" API_HUMID = "humidity" API_LUX = "illuminance" diff --git a/homeassistant/components/awair/sensor.py b/homeassistant/components/awair/sensor.py index a0c4b5ba8fe22..d1f3ec34bf47e 100644 --- a/homeassistant/components/awair/sensor.py +++ b/homeassistant/components/awair/sensor.py @@ -34,6 +34,7 @@ from .const import ( API_CO2, + API_DEW_POINT, API_DUST, API_HUMID, API_LUX, @@ -110,6 +111,15 @@ class AwairSensorEntityDescription(SensorEntityDescription): unique_id_tag="CO2", # matches legacy format state_class=SensorStateClass.MEASUREMENT, ), + AwairSensorEntityDescription( + key=API_DEW_POINT, + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + translation_key="dew_point", + unique_id_tag="dew_point", + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, + ), ) SENSOR_TYPES_DUST: tuple[AwairSensorEntityDescription, ...] = ( diff --git a/homeassistant/components/awair/strings.json b/homeassistant/components/awair/strings.json index a7c5c647af851..30425d2e1bcbd 100644 --- a/homeassistant/components/awair/strings.json +++ b/homeassistant/components/awair/strings.json @@ -57,6 +57,9 @@ }, "sound_level": { "name": "Sound level" + }, + "dew_point": { + "name": "Dew point" } } } diff --git a/homeassistant/components/axis/__init__.py b/homeassistant/components/axis/__init__.py index e6c6fab47a1f6..92bd240c73628 100644 --- a/homeassistant/components/axis/__init__.py +++ b/homeassistant/components/axis/__init__.py @@ -30,7 +30,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: AxisConfigEntry) await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS) hub.setup() - config_entry.add_update_listener(hub.async_new_address_callback) + config_entry.async_on_unload( + config_entry.add_update_listener(hub.async_new_address_callback) + ) config_entry.async_on_unload(hub.teardown) config_entry.async_on_unload( hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, hub.shutdown) diff --git a/homeassistant/components/esphome/manifest.json b/homeassistant/components/esphome/manifest.json index 01e04df6db898..9099af63ad953 100644 --- a/homeassistant/components/esphome/manifest.json +++ b/homeassistant/components/esphome/manifest.json @@ -17,7 +17,7 @@ "mqtt": ["esphome/discover/#"], "quality_scale": "platinum", "requirements": [ - "aioesphomeapi==34.1.0", + "aioesphomeapi==34.2.0", "esphome-dashboard-api==1.3.0", "bleak-esphome==2.16.0" ], diff --git a/homeassistant/components/lifx/manifest.json b/homeassistant/components/lifx/manifest.json index 3c03cdccba223..3c755779846be 100644 --- a/homeassistant/components/lifx/manifest.json +++ b/homeassistant/components/lifx/manifest.json @@ -52,7 +52,7 @@ "iot_class": "local_polling", "loggers": ["aiolifx", "aiolifx_effects", "bitstring"], "requirements": [ - "aiolifx==1.2.0", + "aiolifx==1.2.1", "aiolifx-effects==0.3.2", "aiolifx-themes==0.6.4" ] diff --git a/homeassistant/components/openai_conversation/config_flow.py b/homeassistant/components/openai_conversation/config_flow.py index 63ebc351ee332..ae1e2f31a857c 100644 --- a/homeassistant/components/openai_conversation/config_flow.py +++ b/homeassistant/components/openai_conversation/config_flow.py @@ -66,7 +66,7 @@ RECOMMENDED_WEB_SEARCH_CONTEXT_SIZE, RECOMMENDED_WEB_SEARCH_USER_LOCATION, UNSUPPORTED_MODELS, - WEB_SEARCH_MODELS, + UNSUPPORTED_WEB_SEARCH_MODELS, ) _LOGGER = logging.getLogger(__name__) @@ -320,7 +320,7 @@ async def async_step_model( elif CONF_REASONING_EFFORT in options: options.pop(CONF_REASONING_EFFORT) - if model.startswith(tuple(WEB_SEARCH_MODELS)): + if not model.startswith(tuple(UNSUPPORTED_WEB_SEARCH_MODELS)): step_schema.update( { vol.Optional( diff --git a/homeassistant/components/openai_conversation/const.py b/homeassistant/components/openai_conversation/const.py index 3f1c0dc74297a..6a6a5b2ce6e84 100644 --- a/homeassistant/components/openai_conversation/const.py +++ b/homeassistant/components/openai_conversation/const.py @@ -44,11 +44,10 @@ "gpt-4o-mini-realtime-preview-2024-12-17", ] -WEB_SEARCH_MODELS: list[str] = [ - "gpt-4.1", - "gpt-4.1-mini", - "gpt-4o", - "gpt-4o-search-preview", - "gpt-4o-mini", - "gpt-4o-mini-search-preview", +UNSUPPORTED_WEB_SEARCH_MODELS: list[str] = [ + "gpt-3.5", + "gpt-4-turbo", + "gpt-4.1-nano", + "o1", + "o3-mini", ] diff --git a/homeassistant/components/tuya/binary_sensor.py b/homeassistant/components/tuya/binary_sensor.py index 486dd6e1387de..a613661149fde 100644 --- a/homeassistant/components/tuya/binary_sensor.py +++ b/homeassistant/components/tuya/binary_sensor.py @@ -46,6 +46,40 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription): # 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 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription): ), 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 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription): ), 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 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription): 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 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription): ), 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 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription): # 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": ( diff --git a/homeassistant/components/tuya/button.py b/homeassistant/components/tuya/button.py index 8e538b07309e3..928e584e77d6a 100644 --- a/homeassistant/components/tuya/button.py +++ b/homeassistant/components/tuya/button.py @@ -17,6 +17,14 @@ # 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 @@ entity_category=EntityCategory.CONFIG, ), ), - # Wake Up Light II - # Not documented - "hxd": ( - ButtonEntityDescription( - key=DPCode.SWITCH_USB6, - translation_key="snooze", - ), - ), } diff --git a/homeassistant/components/tuya/camera.py b/homeassistant/components/tuya/camera.py index c04a8a043dc2e..788a9bcc5c3ac 100644 --- a/homeassistant/components/tuya/camera.py +++ b/homeassistant/components/tuya/camera.py @@ -17,12 +17,12 @@ # 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", ) diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index 547f3a14c930a..991c3589e120d 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -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 @@ class TuyaClimateEntityDescription(ClimateEntityDescription): 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), } diff --git a/homeassistant/components/tuya/cover.py b/homeassistant/components/tuya/cover.py index 315075e7f37e8..015daae42121c 100644 --- a/homeassistant/components/tuya/cover.py +++ b/homeassistant/components/tuya/cover.py @@ -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 @@ class TuyaCoverEntityDescription(CoverEntityDescription): 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": ( diff --git a/homeassistant/components/tuya/fan.py b/homeassistant/components/tuya/fan.py index 3b951e75da1d2..f2d856b6d860b 100644 --- a/homeassistant/components/tuya/fan.py +++ b/homeassistant/components/tuya/fan.py @@ -25,11 +25,11 @@ 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 } diff --git a/homeassistant/components/tuya/light.py b/homeassistant/components/tuya/light.py index 67a94c4e26709..37c79b952d46a 100644 --- a/homeassistant/components/tuya/light.py +++ b/homeassistant/components/tuya/light.py @@ -135,6 +135,22 @@ class TuyaLightEntityDescription(LightEntityDescription): 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 @@ class TuyaLightEntityDescription(LightEntityDescription): 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 @@ class TuyaLightEntityDescription(LightEntityDescription): 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 @@ class TuyaLightEntityDescription(LightEntityDescription): 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`) diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index d4fe7836daa85..ddee46b8799e6 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -22,15 +22,6 @@ # 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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`) diff --git a/homeassistant/components/tuya/select.py b/homeassistant/components/tuya/select.py index 21f8815623686..4ad4355f8763b 100644 --- a/homeassistant/components/tuya/select.py +++ b/homeassistant/components/tuya/select.py @@ -18,6 +18,43 @@ # 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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, diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index bdfc8fe15e79f..5151f39eb2623 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -89,78 +89,30 @@ class TuyaSensorEntityDescription(SensorEntityDescription): # end up being a sensor. # https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = { - # Multi-functional Sensor - # https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3 - "dgnbj": ( - TuyaSensorEntityDescription( - key=DPCode.GAS_SENSOR_VALUE, - translation_key="gas", - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.CH4_SENSOR_VALUE, - translation_key="gas", - name="Methane", - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.VOC_VALUE, - translation_key="voc", - device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.PM25_VALUE, - translation_key="pm25", - device_class=SensorDeviceClass.PM25, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.CO_VALUE, - translation_key="carbon_monoxide", - device_class=SensorDeviceClass.CO, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.CO2_VALUE, - translation_key="carbon_dioxide", - device_class=SensorDeviceClass.CO2, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.CH2O_VALUE, - translation_key="formaldehyde", - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.BRIGHT_STATE, - translation_key="luminosity", - ), - TuyaSensorEntityDescription( - key=DPCode.BRIGHT_VALUE, - translation_key="illuminance", - device_class=SensorDeviceClass.ILLUMINANCE, - state_class=SensorStateClass.MEASUREMENT, - ), + # Single Phase power meter + # Note: Undocumented + "aqcz": ( TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.CUR_CURRENT, + translation_key="current", + device_class=SensorDeviceClass.CURRENT, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.CUR_POWER, + translation_key="power", + device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.SMOKE_SENSOR_VALUE, - translation_key="smoke_amount", - entity_category=EntityCategory.DIAGNOSTIC, + key=DPCode.CUR_VOLTAGE, + translation_key="voltage", + device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), - *BATTERY_SENSORS, ), # Smart Kettle # https://developer.tuya.com/en/docs/iot/fbh?id=K9gf484m21yq7 @@ -182,6 +134,15 @@ class TuyaSensorEntityDescription(SensorEntityDescription): translation_key="status", ), ), + # Curtain + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48qy7wkre + "cl": ( + TuyaSensorEntityDescription( + key=DPCode.TIME_TOTAL, + translation_key="last_operation_duration", + entity_category=EntityCategory.DIAGNOSTIC, + ), + ), # CO2 Detector # https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy "co2bj": ( @@ -222,79 +183,32 @@ class TuyaSensorEntityDescription(SensorEntityDescription): ), *BATTERY_SENSORS, ), - # Two-way temperature and humidity switch - # "MOES Temperature and Humidity Smart Switch Module MS-103" - # Documentation not found - "wkcz": ( + # CO Detector + # https://developer.tuya.com/en/docs/iot/categorycobj?id=Kaiuz3u1j6q1v + "cobj": ( TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.CO_VALUE, + translation_key="carbon_monoxide", + device_class=SensorDeviceClass.CO, state_class=SensorStateClass.MEASUREMENT, ), + *BATTERY_SENSORS, + ), + # Dehumidifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r6jke8e + "cs": ( TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, + key=DPCode.TEMP_INDOOR, translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.CUR_CURRENT, - translation_key="current", - device_class=SensorDeviceClass.CURRENT, - state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, - ), - TuyaSensorEntityDescription( - key=DPCode.CUR_POWER, - translation_key="power", - device_class=SensorDeviceClass.POWER, - state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, - ), - TuyaSensorEntityDescription( - key=DPCode.CUR_VOLTAGE, - translation_key="voltage", - device_class=SensorDeviceClass.VOLTAGE, - state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, - ), - ), - # Single Phase power meter - # Note: Undocumented - "aqcz": ( - TuyaSensorEntityDescription( - key=DPCode.CUR_CURRENT, - translation_key="current", - device_class=SensorDeviceClass.CURRENT, - state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, - ), - TuyaSensorEntityDescription( - key=DPCode.CUR_POWER, - translation_key="power", - device_class=SensorDeviceClass.POWER, - state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, - ), - TuyaSensorEntityDescription( - key=DPCode.CUR_VOLTAGE, - translation_key="voltage", - device_class=SensorDeviceClass.VOLTAGE, - state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, - ), - ), - # CO Detector - # https://developer.tuya.com/en/docs/iot/categorycobj?id=Kaiuz3u1j6q1v - "cobj": ( - TuyaSensorEntityDescription( - key=DPCode.CO_VALUE, - translation_key="carbon_monoxide", - device_class=SensorDeviceClass.CO, + key=DPCode.HUMIDITY_INDOOR, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, ), - *BATTERY_SENSORS, ), # Smart Pet Feeder # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld @@ -338,34 +252,18 @@ class TuyaSensorEntityDescription(SensorEntityDescription): key=DPCode.WATER_LEVEL, translation_key="water_level_state" ), ), - # Air Quality Monitor - # https://developer.tuya.com/en/docs/iot/hjjcy?id=Kbeoad8y1nnlv - "hjjcy": ( - TuyaSensorEntityDescription( - key=DPCode.AIR_QUALITY_INDEX, - translation_key="air_quality_index", - ), - TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, - state_class=SensorStateClass.MEASUREMENT, - ), + # Multi-functional Sensor + # https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3 + "dgnbj": ( TuyaSensorEntityDescription( - key=DPCode.CO2_VALUE, - translation_key="carbon_dioxide", - device_class=SensorDeviceClass.CO2, + key=DPCode.GAS_SENSOR_VALUE, + translation_key="gas", state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.CH2O_VALUE, - translation_key="formaldehyde", + key=DPCode.CH4_SENSOR_VALUE, + translation_key="gas", + name="Methane", state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( @@ -381,16 +279,11 @@ class TuyaSensorEntityDescription(SensorEntityDescription): state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.PM10, - translation_key="pm10", - device_class=SensorDeviceClass.PM10, + key=DPCode.CO_VALUE, + translation_key="carbon_monoxide", + device_class=SensorDeviceClass.CO, state_class=SensorStateClass.MEASUREMENT, ), - *BATTERY_SENSORS, - ), - # Formaldehyde Detector - # Note: Not documented - "jqbj": ( TuyaSensorEntityDescription( key=DPCode.CO2_VALUE, translation_key="carbon_dioxide", @@ -398,139 +291,168 @@ class TuyaSensorEntityDescription(SensorEntityDescription): state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.VOC_VALUE, - translation_key="voc", - device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + key=DPCode.CH2O_VALUE, + translation_key="formaldehyde", state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.PM25_VALUE, - translation_key="pm25", - device_class=SensorDeviceClass.PM25, - state_class=SensorStateClass.MEASUREMENT, + key=DPCode.BRIGHT_STATE, + translation_key="luminosity", ), TuyaSensorEntityDescription( - key=DPCode.VA_HUMIDITY, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.BRIGHT_VALUE, + translation_key="illuminance", + device_class=SensorDeviceClass.ILLUMINANCE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.VA_TEMPERATURE, + key=DPCode.TEMP_CURRENT, translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.CH2O_VALUE, - translation_key="formaldehyde", + key=DPCode.HUMIDITY_VALUE, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, ), - *BATTERY_SENSORS, - ), - # Methane Detector - # https://developer.tuya.com/en/docs/iot/categoryjwbj?id=Kaiuz40u98lkm - "jwbj": ( TuyaSensorEntityDescription( - key=DPCode.CH4_SENSOR_VALUE, - translation_key="methane", + key=DPCode.SMOKE_SENSOR_VALUE, + translation_key="smoke_amount", + entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.MEASUREMENT, ), *BATTERY_SENSORS, ), - # Switch - # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s - "kg": ( + # Circuit Breaker + # https://developer.tuya.com/en/docs/iot/dlq?id=Kb0kidk9enyh8 + "dlq": ( TuyaSensorEntityDescription( - key=DPCode.CUR_CURRENT, - translation_key="current", - device_class=SensorDeviceClass.CURRENT, - state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, + key=DPCode.TOTAL_FORWARD_ENERGY, + translation_key="total_energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, ), TuyaSensorEntityDescription( - key=DPCode.CUR_POWER, - translation_key="power", + key=DPCode.CUR_NEUTRAL, + translation_key="total_production", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_A, + translation_key="phase_a_current", + device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + state_class=SensorStateClass.MEASUREMENT, + subkey="electriccurrent", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_A, + translation_key="phase_a_power", device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.CUR_VOLTAGE, - translation_key="voltage", + key=DPCode.PHASE_A, + translation_key="phase_a_voltage", device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + subkey="voltage", ), - ), - # IoT Switch - # Note: Undocumented - "tdq": ( TuyaSensorEntityDescription( - key=DPCode.CUR_CURRENT, - translation_key="current", + key=DPCode.PHASE_B, + translation_key="phase_b_current", device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, + subkey="electriccurrent", ), TuyaSensorEntityDescription( - key=DPCode.CUR_POWER, - translation_key="power", + key=DPCode.PHASE_B, + translation_key="phase_b_power", device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.CUR_VOLTAGE, - translation_key="voltage", + key=DPCode.PHASE_B, + translation_key="phase_b_voltage", device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + subkey="voltage", ), TuyaSensorEntityDescription( - key=DPCode.VA_TEMPERATURE, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.PHASE_C, + translation_key="phase_c_current", + device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + state_class=SensorStateClass.MEASUREMENT, + subkey="electriccurrent", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_C, + translation_key="phase_c_power", + device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.PHASE_C, + translation_key="phase_c_voltage", + device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + subkey="voltage", ), TuyaSensorEntityDescription( - key=DPCode.VA_HUMIDITY, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.CUR_CURRENT, + translation_key="current", + device_class=SensorDeviceClass.CURRENT, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.CUR_POWER, + translation_key="power", + device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.BRIGHT_VALUE, - translation_key="illuminance", - device_class=SensorDeviceClass.ILLUMINANCE, + key=DPCode.CUR_VOLTAGE, + translation_key="voltage", + device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), - *BATTERY_SENSORS, ), - # Luminance Sensor - # https://developer.tuya.com/en/docs/iot/categoryldcg?id=Kaiuz3n7u69l8 - "ldcg": ( + # Fan + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48quojr54 + "fs": ( TuyaSensorEntityDescription( - key=DPCode.BRIGHT_STATE, - translation_key="luminosity", + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, ), + ), + # Irrigator + # https://developer.tuya.com/en/docs/iot/categoryggq?id=Kaiuz1qib7z0k + "ggq": BATTERY_SENSORS, + # Air Quality Monitor + # https://developer.tuya.com/en/docs/iot/hjjcy?id=Kbeoad8y1nnlv + "hjjcy": ( TuyaSensorEntityDescription( - key=DPCode.BRIGHT_VALUE, - translation_key="illuminance", - device_class=SensorDeviceClass.ILLUMINANCE, - state_class=SensorStateClass.MEASUREMENT, + key=DPCode.AIR_QUALITY_INDEX, + translation_key="air_quality_index", ), TuyaSensorEntityDescription( key=DPCode.TEMP_CURRENT, @@ -550,45 +472,6 @@ class TuyaSensorEntityDescription(SensorEntityDescription): device_class=SensorDeviceClass.CO2, state_class=SensorStateClass.MEASUREMENT, ), - *BATTERY_SENSORS, - ), - # Door and Window Controller - # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r5zjsy9 - "mc": BATTERY_SENSORS, - # Door Window Sensor - # https://developer.tuya.com/en/docs/iot/s?id=K9gf48hm02l8m - "mcs": BATTERY_SENSORS, - # Sous Vide Cooker - # https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux - "mzj": ( - TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="current_temperature", - device_class=SensorDeviceClass.TEMPERATURE, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.STATUS, - translation_key="sous_vide_status", - ), - TuyaSensorEntityDescription( - key=DPCode.REMAIN_TIME, - translation_key="remaining_time", - native_unit_of_measurement=UnitOfTime.MINUTES, - ), - ), - # PIR Detector - # https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80 - "pir": BATTERY_SENSORS, - # PM2.5 Sensor - # https://developer.tuya.com/en/docs/iot/categorypm25?id=Kaiuz3qof3yfu - "pm2.5": ( - TuyaSensorEntityDescription( - key=DPCode.PM25_VALUE, - translation_key="pm25", - device_class=SensorDeviceClass.PM25, - state_class=SensorStateClass.MEASUREMENT, - ), TuyaSensorEntityDescription( key=DPCode.CH2O_VALUE, translation_key="formaldehyde", @@ -601,27 +484,9 @@ class TuyaSensorEntityDescription(SensorEntityDescription): state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.CO2_VALUE, - translation_key="carbon_dioxide", - device_class=SensorDeviceClass.CO2, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.PM1, - translation_key="pm1", - device_class=SensorDeviceClass.PM1, + key=DPCode.PM25_VALUE, + translation_key="pm25", + device_class=SensorDeviceClass.PM25, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( @@ -632,88 +497,37 @@ class TuyaSensorEntityDescription(SensorEntityDescription): ), *BATTERY_SENSORS, ), - # Heater - # https://developer.tuya.com/en/docs/iot/categoryqn?id=Kaiuz18kih0sm - "qn": ( + # Formaldehyde Detector + # Note: Not documented + "jqbj": ( TuyaSensorEntityDescription( - key=DPCode.WORK_POWER, - translation_key="power", - device_class=SensorDeviceClass.POWER, + key=DPCode.CO2_VALUE, + translation_key="carbon_dioxide", + device_class=SensorDeviceClass.CO2, state_class=SensorStateClass.MEASUREMENT, ), - ), - # Gas Detector - # https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw - "rqbj": ( TuyaSensorEntityDescription( - key=DPCode.GAS_SENSOR_VALUE, - name=None, - translation_key="gas", + key=DPCode.VOC_VALUE, + translation_key="voc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, state_class=SensorStateClass.MEASUREMENT, ), - *BATTERY_SENSORS, - ), - # Smart Water Timer - "sfkzq": ( - # Total seconds of irrigation. Read-write value; the device appears to ignore the write action (maybe firmware bug) TuyaSensorEntityDescription( - key=DPCode.TIME_USE, - translation_key="total_watering_time", - state_class=SensorStateClass.TOTAL_INCREASING, - entity_category=EntityCategory.DIAGNOSTIC, - ), - *BATTERY_SENSORS, - ), - # Irrigator - # https://developer.tuya.com/en/docs/iot/categoryggq?id=Kaiuz1qib7z0k - "ggq": BATTERY_SENSORS, - # Water Detector - # https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli - "sj": BATTERY_SENSORS, - # Emergency Button - # https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy - "sos": BATTERY_SENSORS, - # Smart Camera - # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 - "sp": ( - TuyaSensorEntityDescription( - key=DPCode.SENSOR_TEMPERATURE, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.PM25_VALUE, + translation_key="pm25", + device_class=SensorDeviceClass.PM25, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.SENSOR_HUMIDITY, + key=DPCode.VA_HUMIDITY, translation_key="humidity", device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.WIRELESS_ELECTRICITY, - translation_key="battery", - device_class=SensorDeviceClass.BATTERY, - entity_category=EntityCategory.DIAGNOSTIC, - state_class=SensorStateClass.MEASUREMENT, - ), - ), - # Fingerbot - "szjqr": BATTERY_SENSORS, - # Solar Light - # https://developer.tuya.com/en/docs/iot/tynd?id=Kaof8j02e1t98 - "tyndj": BATTERY_SENSORS, - # Volatile Organic Compound Sensor - # Note: Undocumented in cloud API docs, based on test device - "voc": ( - TuyaSensorEntityDescription( - key=DPCode.CO2_VALUE, - translation_key="carbon_dioxide", - device_class=SensorDeviceClass.CO2, - state_class=SensorStateClass.MEASUREMENT, - ), - TuyaSensorEntityDescription( - key=DPCode.PM25_VALUE, - translation_key="pm25", - device_class=SensorDeviceClass.PM25, + key=DPCode.VA_TEMPERATURE, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( @@ -721,8 +535,13 @@ class TuyaSensorEntityDescription(SensorEntityDescription): translation_key="formaldehyde", state_class=SensorStateClass.MEASUREMENT, ), + *BATTERY_SENSORS, + ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48qwjz0i3 + "jsq": ( TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, + key=DPCode.HUMIDITY_CURRENT, translation_key="humidity", device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, @@ -734,320 +553,281 @@ class TuyaSensorEntityDescription(SensorEntityDescription): state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.VOC_VALUE, - translation_key="voc", - device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, - state_class=SensorStateClass.MEASUREMENT, - ), - *BATTERY_SENSORS, - ), - # Thermostatic Radiator Valve - # Not documented - "wkf": BATTERY_SENSORS, - # Temperature and Humidity Sensor - # https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34 - "wsdcg": ( - TuyaSensorEntityDescription( - key=DPCode.VA_TEMPERATURE, + key=DPCode.TEMP_CURRENT_F, translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.LEVEL_CURRENT, + translation_key="water_level", + entity_category=EntityCategory.DIAGNOSTIC, + ), + ), + # Methane Detector + # https://developer.tuya.com/en/docs/iot/categoryjwbj?id=Kaiuz40u98lkm + "jwbj": ( + TuyaSensorEntityDescription( + key=DPCode.CH4_SENSOR_VALUE, + translation_key="methane", state_class=SensorStateClass.MEASUREMENT, ), + *BATTERY_SENSORS, + ), + # Switch + # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s + "kg": ( TuyaSensorEntityDescription( - key=DPCode.VA_HUMIDITY, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.CUR_CURRENT, + translation_key="current", + device_class=SensorDeviceClass.CURRENT, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.CUR_POWER, + translation_key="power", + device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.BRIGHT_VALUE, - translation_key="illuminance", - device_class=SensorDeviceClass.ILLUMINANCE, + key=DPCode.CUR_VOLTAGE, + translation_key="voltage", + device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), - *BATTERY_SENSORS, ), - # Temperature and Humidity Sensor with External Probe - # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472 - "qxj": ( + # Air Purifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r41mn81 + "kj": ( TuyaSensorEntityDescription( - key=DPCode.VA_TEMPERATURE, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, - state_class=SensorStateClass.MEASUREMENT, + key=DPCode.FILTER, + translation_key="filter_utilization", + entity_category=EntityCategory.DIAGNOSTIC, ), TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.PM25, + translation_key="pm25", + device_class=SensorDeviceClass.PM25, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT_EXTERNAL, - translation_key="temperature_external", + key=DPCode.TEMP, + translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.VA_HUMIDITY, + key=DPCode.HUMIDITY, translation_key="humidity", device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_VALUE, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.TVOC, + translation_key="total_volatile_organic_compound", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.BRIGHT_VALUE, - translation_key="illuminance", - device_class=SensorDeviceClass.ILLUMINANCE, + key=DPCode.ECO2, + translation_key="concentration_carbon_dioxide", + device_class=SensorDeviceClass.CO2, state_class=SensorStateClass.MEASUREMENT, ), - *BATTERY_SENSORS, - ), - # Pressure Sensor - # https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm - "ylcg": ( TuyaSensorEntityDescription( - key=DPCode.PRESSURE_VALUE, - name=None, - device_class=SensorDeviceClass.PRESSURE, - state_class=SensorStateClass.MEASUREMENT, + key=DPCode.TOTAL_TIME, + translation_key="total_operating_time", + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, ), - *BATTERY_SENSORS, - ), - # Smoke Detector - # https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952 - "ywbj": ( TuyaSensorEntityDescription( - key=DPCode.SMOKE_SENSOR_VALUE, - translation_key="smoke_amount", + key=DPCode.TOTAL_PM, + translation_key="total_absorption_particles", + state_class=SensorStateClass.TOTAL_INCREASING, entity_category=EntityCategory.DIAGNOSTIC, - state_class=SensorStateClass.MEASUREMENT, ), - *BATTERY_SENSORS, - ), - # Vibration Sensor - # https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno - "zd": BATTERY_SENSORS, - # Smart Electricity Meter - # https://developer.tuya.com/en/docs/iot/smart-meter?id=Kaiuz4gv6ack7 - "zndb": ( TuyaSensorEntityDescription( - key=DPCode.FORWARD_ENERGY_TOTAL, - translation_key="total_energy", - device_class=SensorDeviceClass.ENERGY, - state_class=SensorStateClass.TOTAL_INCREASING, + key=DPCode.AIR_QUALITY, + translation_key="air_quality", ), + ), + # Luminance Sensor + # https://developer.tuya.com/en/docs/iot/categoryldcg?id=Kaiuz3n7u69l8 + "ldcg": ( TuyaSensorEntityDescription( - key=DPCode.REVERSE_ENERGY_TOTAL, - translation_key="total_energy", - device_class=SensorDeviceClass.ENERGY, - state_class=SensorStateClass.TOTAL_INCREASING, + key=DPCode.BRIGHT_STATE, + translation_key="luminosity", ), TuyaSensorEntityDescription( - key=DPCode.TOTAL_POWER, - translation_key="total_power", - device_class=SensorDeviceClass.POWER, + key=DPCode.BRIGHT_VALUE, + translation_key="illuminance", + device_class=SensorDeviceClass.ILLUMINANCE, state_class=SensorStateClass.MEASUREMENT, - subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_A, - translation_key="phase_a_current", - device_class=SensorDeviceClass.CURRENT, - native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - subkey="electriccurrent", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_A, - translation_key="phase_a_power", - device_class=SensorDeviceClass.POWER, + key=DPCode.HUMIDITY_VALUE, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfPower.KILO_WATT, - subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_A, - translation_key="phase_a_voltage", - device_class=SensorDeviceClass.VOLTAGE, + key=DPCode.CO2_VALUE, + translation_key="carbon_dioxide", + device_class=SensorDeviceClass.CO2, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfElectricPotential.VOLT, - subkey="voltage", ), + *BATTERY_SENSORS, + ), + # Door and Window Controller + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r5zjsy9 + "mc": BATTERY_SENSORS, + # Door Window Sensor + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48hm02l8m + "mcs": BATTERY_SENSORS, + # Sous Vide Cooker + # https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux + "mzj": ( TuyaSensorEntityDescription( - key=DPCode.PHASE_B, - translation_key="phase_b_current", - device_class=SensorDeviceClass.CURRENT, - native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + key=DPCode.TEMP_CURRENT, + translation_key="current_temperature", + device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - subkey="electriccurrent", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_B, - translation_key="phase_b_power", - device_class=SensorDeviceClass.POWER, - state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfPower.KILO_WATT, - subkey="power", + key=DPCode.STATUS, + translation_key="sous_vide_status", + ), + TuyaSensorEntityDescription( + key=DPCode.REMAIN_TIME, + translation_key="remaining_time", + native_unit_of_measurement=UnitOfTime.MINUTES, ), + ), + # PIR Detector + # https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80 + "pir": BATTERY_SENSORS, + # PM2.5 Sensor + # https://developer.tuya.com/en/docs/iot/categorypm25?id=Kaiuz3qof3yfu + "pm2.5": ( TuyaSensorEntityDescription( - key=DPCode.PHASE_B, - translation_key="phase_b_voltage", - device_class=SensorDeviceClass.VOLTAGE, + key=DPCode.PM25_VALUE, + translation_key="pm25", + device_class=SensorDeviceClass.PM25, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfElectricPotential.VOLT, - subkey="voltage", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_C, - translation_key="phase_c_current", - device_class=SensorDeviceClass.CURRENT, - native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + key=DPCode.CH2O_VALUE, + translation_key="formaldehyde", state_class=SensorStateClass.MEASUREMENT, - subkey="electriccurrent", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_C, - translation_key="phase_c_power", - device_class=SensorDeviceClass.POWER, + key=DPCode.VOC_VALUE, + translation_key="voc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfPower.KILO_WATT, - subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_C, - translation_key="phase_c_voltage", - device_class=SensorDeviceClass.VOLTAGE, + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfElectricPotential.VOLT, - subkey="voltage", - ), - ), - # Circuit Breaker - # https://developer.tuya.com/en/docs/iot/dlq?id=Kb0kidk9enyh8 - "dlq": ( - TuyaSensorEntityDescription( - key=DPCode.TOTAL_FORWARD_ENERGY, - translation_key="total_energy", - device_class=SensorDeviceClass.ENERGY, - state_class=SensorStateClass.TOTAL_INCREASING, - ), - TuyaSensorEntityDescription( - key=DPCode.CUR_NEUTRAL, - translation_key="total_production", - device_class=SensorDeviceClass.ENERGY, - state_class=SensorStateClass.TOTAL_INCREASING, ), TuyaSensorEntityDescription( - key=DPCode.PHASE_A, - translation_key="phase_a_current", - device_class=SensorDeviceClass.CURRENT, - native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + key=DPCode.CO2_VALUE, + translation_key="carbon_dioxide", + device_class=SensorDeviceClass.CO2, state_class=SensorStateClass.MEASUREMENT, - subkey="electriccurrent", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_A, - translation_key="phase_a_power", - device_class=SensorDeviceClass.POWER, + key=DPCode.HUMIDITY_VALUE, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfPower.KILO_WATT, - subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_A, - translation_key="phase_a_voltage", - device_class=SensorDeviceClass.VOLTAGE, + key=DPCode.PM1, + translation_key="pm1", + device_class=SensorDeviceClass.PM1, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfElectricPotential.VOLT, - subkey="voltage", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_B, - translation_key="phase_b_current", - device_class=SensorDeviceClass.CURRENT, - native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + key=DPCode.PM10, + translation_key="pm10", + device_class=SensorDeviceClass.PM10, state_class=SensorStateClass.MEASUREMENT, - subkey="electriccurrent", ), + *BATTERY_SENSORS, + ), + # Heater + # https://developer.tuya.com/en/docs/iot/categoryqn?id=Kaiuz18kih0sm + "qn": ( TuyaSensorEntityDescription( - key=DPCode.PHASE_B, - translation_key="phase_b_power", + key=DPCode.WORK_POWER, + translation_key="power", device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfPower.KILO_WATT, - subkey="power", ), + ), + # Temperature and Humidity Sensor with External Probe + # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472 + "qxj": ( TuyaSensorEntityDescription( - key=DPCode.PHASE_B, - translation_key="phase_b_voltage", - device_class=SensorDeviceClass.VOLTAGE, + key=DPCode.VA_TEMPERATURE, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfElectricPotential.VOLT, - subkey="voltage", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_C, - translation_key="phase_c_current", - device_class=SensorDeviceClass.CURRENT, - native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - subkey="electriccurrent", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_C, - translation_key="phase_c_power", - device_class=SensorDeviceClass.POWER, + key=DPCode.TEMP_CURRENT_EXTERNAL, + translation_key="temperature_external", + device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfPower.KILO_WATT, - subkey="power", ), TuyaSensorEntityDescription( - key=DPCode.PHASE_C, - translation_key="phase_c_voltage", - device_class=SensorDeviceClass.VOLTAGE, + key=DPCode.VA_HUMIDITY, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, - native_unit_of_measurement=UnitOfElectricPotential.VOLT, - subkey="voltage", ), TuyaSensorEntityDescription( - key=DPCode.CUR_CURRENT, - translation_key="current", - device_class=SensorDeviceClass.CURRENT, + key=DPCode.HUMIDITY_VALUE, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.CUR_POWER, - translation_key="power", - device_class=SensorDeviceClass.POWER, + key=DPCode.BRIGHT_VALUE, + translation_key="illuminance", + device_class=SensorDeviceClass.ILLUMINANCE, state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, ), + *BATTERY_SENSORS, + ), + # Gas Detector + # https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw + "rqbj": ( TuyaSensorEntityDescription( - key=DPCode.CUR_VOLTAGE, - translation_key="voltage", - device_class=SensorDeviceClass.VOLTAGE, + key=DPCode.GAS_SENSOR_VALUE, + name=None, + translation_key="gas", state_class=SensorStateClass.MEASUREMENT, - entity_registry_enabled_default=False, ), + *BATTERY_SENSORS, ), # Robot Vacuum # https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo @@ -1098,6 +878,46 @@ class TuyaSensorEntityDescription(SensorEntityDescription): state_class=SensorStateClass.MEASUREMENT, ), ), + # Smart Water Timer + "sfkzq": ( + # Total seconds of irrigation. Read-write value; the device appears to ignore the write action (maybe firmware bug) + TuyaSensorEntityDescription( + key=DPCode.TIME_USE, + translation_key="total_watering_time", + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + *BATTERY_SENSORS, + ), + # Water Detector + # https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli + "sj": BATTERY_SENSORS, + # Emergency Button + # https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy + "sos": BATTERY_SENSORS, + # Smart Camera + # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 + "sp": ( + TuyaSensorEntityDescription( + key=DPCode.SENSOR_TEMPERATURE, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.SENSOR_HUMIDITY, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.WIRELESS_ELECTRICITY, + translation_key="battery", + device_class=SensorDeviceClass.BATTERY, + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + ), + ), # Smart Gardening system # https://developer.tuya.com/en/docs/iot/categorysz?id=Kaiuz4e6h7up0 "sz": ( @@ -1114,107 +934,148 @@ class TuyaSensorEntityDescription(SensorEntityDescription): state_class=SensorStateClass.MEASUREMENT, ), ), - # Curtain - # https://developer.tuya.com/en/docs/iot/s?id=K9gf48qy7wkre - "cl": ( + # Fingerbot + "szjqr": BATTERY_SENSORS, + # IoT Switch + # Note: Undocumented + "tdq": ( TuyaSensorEntityDescription( - key=DPCode.TIME_TOTAL, - translation_key="last_operation_duration", - entity_category=EntityCategory.DIAGNOSTIC, + key=DPCode.CUR_CURRENT, + translation_key="current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), - ), - # Humidifier - # https://developer.tuya.com/en/docs/iot/s?id=K9gf48qwjz0i3 - "jsq": ( TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_CURRENT, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.CUR_POWER, + translation_key="power", + device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, + key=DPCode.CUR_VOLTAGE, + translation_key="voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, + ), + TuyaSensorEntityDescription( + key=DPCode.VA_TEMPERATURE, translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT_F, + key=DPCode.TEMP_CURRENT, translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.LEVEL_CURRENT, - translation_key="water_level", - entity_category=EntityCategory.DIAGNOSTIC, + 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, ), - # Air Purifier - # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r41mn81 - "kj": ( + # Solar Light + # https://developer.tuya.com/en/docs/iot/tynd?id=Kaof8j02e1t98 + "tyndj": BATTERY_SENSORS, + # Volatile Organic Compound Sensor + # Note: Undocumented in cloud API docs, based on test device + "voc": ( TuyaSensorEntityDescription( - key=DPCode.FILTER, - translation_key="filter_utilization", - entity_category=EntityCategory.DIAGNOSTIC, + key=DPCode.CO2_VALUE, + translation_key="carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.PM25, + key=DPCode.PM25_VALUE, translation_key="pm25", device_class=SensorDeviceClass.PM25, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TEMP, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.CH2O_VALUE, + translation_key="formaldehyde", state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.HUMIDITY, + key=DPCode.HUMIDITY_VALUE, translation_key="humidity", device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TVOC, - translation_key="total_volatile_organic_compound", + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.VOC_VALUE, + translation_key="voc", device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, state_class=SensorStateClass.MEASUREMENT, ), + *BATTERY_SENSORS, + ), + # Two-way temperature and humidity switch + # "MOES Temperature and Humidity Smart Switch Module MS-103" + # Documentation not found + "wkcz": ( TuyaSensorEntityDescription( - key=DPCode.ECO2, - translation_key="concentration_carbon_dioxide", - device_class=SensorDeviceClass.CO2, + key=DPCode.HUMIDITY_VALUE, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TOTAL_TIME, - translation_key="total_operating_time", - state_class=SensorStateClass.TOTAL_INCREASING, - entity_category=EntityCategory.DIAGNOSTIC, + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.TOTAL_PM, - translation_key="total_absorption_particles", - state_class=SensorStateClass.TOTAL_INCREASING, - entity_category=EntityCategory.DIAGNOSTIC, + key=DPCode.CUR_CURRENT, + translation_key="current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), TuyaSensorEntityDescription( - key=DPCode.AIR_QUALITY, - translation_key="air_quality", + key=DPCode.CUR_POWER, + translation_key="power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), - ), - # Fan - # https://developer.tuya.com/en/docs/iot/s?id=K9gf48quojr54 - "fs": ( TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.CUR_VOLTAGE, + translation_key="voltage", + device_class=SensorDeviceClass.VOLTAGE, state_class=SensorStateClass.MEASUREMENT, + entity_registry_enabled_default=False, ), ), + # Thermostatic Radiator Valve + # Not documented + "wkf": BATTERY_SENSORS, # eMylo Smart WiFi IR Remote # Air Conditioner Mate (Smart IR Socket) "wnykq": ( @@ -1255,38 +1116,163 @@ class TuyaSensorEntityDescription(SensorEntityDescription): entity_registry_enabled_default=False, ), ), - # Dehumidifier - # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r6jke8e - "cs": ( + # Temperature and Humidity Sensor + # https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34 + "wsdcg": ( TuyaSensorEntityDescription( - key=DPCode.TEMP_INDOOR, + key=DPCode.VA_TEMPERATURE, translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, ), TuyaSensorEntityDescription( - key=DPCode.HUMIDITY_INDOOR, + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + 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, ), - # Soil sensor (Plant monitor) - "zwjcy": ( + # Wireless Switch + # https://developer.tuya.com/en/docs/iot/s?id=Kbeoa9fkv6brp + "wxkg": BATTERY_SENSORS, # Pressure Sensor + # https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm + "ylcg": ( TuyaSensorEntityDescription( - key=DPCode.TEMP_CURRENT, - translation_key="temperature", - device_class=SensorDeviceClass.TEMPERATURE, + key=DPCode.PRESSURE_VALUE, + name=None, + device_class=SensorDeviceClass.PRESSURE, state_class=SensorStateClass.MEASUREMENT, ), + *BATTERY_SENSORS, + ), + # Smoke Detector + # https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952 + "ywbj": ( TuyaSensorEntityDescription( - key=DPCode.HUMIDITY, - translation_key="humidity", - device_class=SensorDeviceClass.HUMIDITY, + key=DPCode.SMOKE_SENSOR_VALUE, + translation_key="smoke_amount", + entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.MEASUREMENT, ), *BATTERY_SENSORS, ), + # Vibration Sensor + # https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno + "zd": BATTERY_SENSORS, + # Smart Electricity Meter + # https://developer.tuya.com/en/docs/iot/smart-meter?id=Kaiuz4gv6ack7 + "zndb": ( + TuyaSensorEntityDescription( + key=DPCode.FORWARD_ENERGY_TOTAL, + translation_key="total_energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + ), + TuyaSensorEntityDescription( + key=DPCode.REVERSE_ENERGY_TOTAL, + translation_key="total_energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + ), + TuyaSensorEntityDescription( + key=DPCode.TOTAL_POWER, + translation_key="total_power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + subkey="power", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_A, + translation_key="phase_a_current", + device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + state_class=SensorStateClass.MEASUREMENT, + subkey="electriccurrent", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_A, + translation_key="phase_a_power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + subkey="power", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_A, + translation_key="phase_a_voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + subkey="voltage", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_B, + translation_key="phase_b_current", + device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + state_class=SensorStateClass.MEASUREMENT, + subkey="electriccurrent", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_B, + translation_key="phase_b_power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + subkey="power", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_B, + translation_key="phase_b_voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + subkey="voltage", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_C, + translation_key="phase_c_current", + device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + state_class=SensorStateClass.MEASUREMENT, + subkey="electriccurrent", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_C, + translation_key="phase_c_power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfPower.KILO_WATT, + subkey="power", + ), + TuyaSensorEntityDescription( + key=DPCode.PHASE_C, + translation_key="phase_c_voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + subkey="voltage", + ), + ), # VESKA-micro inverter "znnbq": ( TuyaSensorEntityDescription( @@ -1314,23 +1300,36 @@ class TuyaSensorEntityDescription(SensorEntityDescription): state_class=SensorStateClass.MEASUREMENT, ), ), - # Wireless Switch - # https://developer.tuya.com/en/docs/iot/s?id=Kbeoa9fkv6brp - "wxkg": BATTERY_SENSORS, + # Soil sensor (Plant monitor) + "zwjcy": ( + TuyaSensorEntityDescription( + key=DPCode.TEMP_CURRENT, + translation_key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.HUMIDITY, + translation_key="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), } # Socket (duplicate of `kg`) # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s SENSORS["cz"] = SENSORS["kg"] -# Power Socket (duplicate of `kg`) -# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s -SENSORS["pc"] = SENSORS["kg"] - # Smart Camera - Low power consumption camera (duplicate of `sp`) # Undocumented, see https://github.com/home-assistant/core/issues/132844 SENSORS["dghsxj"] = SENSORS["sp"] +# Power Socket (duplicate of `kg`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +SENSORS["pc"] = SENSORS["kg"] + async def async_setup_entry( hass: HomeAssistant, diff --git a/homeassistant/components/tuya/siren.py b/homeassistant/components/tuya/siren.py index 039442dafe52f..8003dc2cf212e 100644 --- a/homeassistant/components/tuya/siren.py +++ b/homeassistant/components/tuya/siren.py @@ -23,6 +23,14 @@ # 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 @@ 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`) diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index b786644fd057d..9b4cc332d9408 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -37,6 +37,20 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ translation_key="switch", ), ), - # Hejhome whitelabel Fingerbot - "znjxs": ( - SwitchEntityDescription( - key=DPCode.SWITCH, - translation_key="switch", - ), - ), # IoT Switch? # Note: Undocumented "tdq": ( @@ -606,6 +700,21 @@ 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 @@ 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 @@ translation_key="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, - ), - ), - # 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, - ), + # Hejhome whitelabel Fingerbot + "znjxs": ( SwitchEntityDescription( - key=DPCode.STERILIZATION, - translation_key="sterilization", - entity_category=EntityCategory.CONFIG, + key=DPCode.SWITCH, + translation_key="switch", ), ), # Pool HeatPump @@ -753,46 +793,6 @@ 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`) diff --git a/homeassistant/components/unifi/hub/hub.py b/homeassistant/components/unifi/hub/hub.py index f2ed95a0c79cf..6cf8825a26cd5 100644 --- a/homeassistant/components/unifi/hub/hub.py +++ b/homeassistant/components/unifi/hub/hub.py @@ -91,7 +91,9 @@ async def initialize(self) -> None: assert self.config.entry.unique_id is not None self.is_admin = self.api.sites[self.config.entry.unique_id].role == "admin" - self.config.entry.add_update_listener(self.async_config_entry_updated) + self.config.entry.async_on_unload( + self.config.entry.add_update_listener(self.async_config_entry_updated) + ) @property def device_info(self) -> DeviceInfo: diff --git a/homeassistant/components/xiaomi_ble/strings.json b/homeassistant/components/xiaomi_ble/strings.json index 06b49b8e86f75..ffdd8f29a79f5 100644 --- a/homeassistant/components/xiaomi_ble/strings.json +++ b/homeassistant/components/xiaomi_ble/strings.json @@ -59,13 +59,13 @@ "device_automation": { "trigger_subtype": { "press": "Press", - "double_press": "Double Press", - "long_press": "Long Press", - "motion_detected": "Motion Detected", - "rotate_left": "Rotate Left", - "rotate_right": "Rotate Right", - "rotate_left_pressed": "Rotate Left (Pressed)", - "rotate_right_pressed": "Rotate Right (Pressed)", + "double_press": "Double press", + "long_press": "Long press", + "motion_detected": "Motion detected", + "rotate_left": "Rotate left", + "rotate_right": "Rotate right", + "rotate_left_pressed": "Rotate left (pressed)", + "rotate_right_pressed": "Rotate right (pressed)", "match_successful": "Match successful", "match_failed": "Match failed", "low_quality_too_light_fuzzy": "Low quality (too light, fuzzy)", @@ -224,7 +224,7 @@ "state_attributes": { "event_type": { "state": { - "motion_detected": "Motion Detected" + "motion_detected": "Motion detected" } } } @@ -235,7 +235,7 @@ "name": "Impedance" }, "weight_non_stabilized": { - "name": "Weight non stabilized" + "name": "Weight non-stabilized" } } } diff --git a/homeassistant/components/zabbix/__init__.py b/homeassistant/components/zabbix/__init__.py index 31a09242a7142..432b5d50c4e04 100644 --- a/homeassistant/components/zabbix/__init__.py +++ b/homeassistant/components/zabbix/__init__.py @@ -13,7 +13,7 @@ import voluptuous as vol from zabbix_utils import ItemValue, Sender, ZabbixAPI -from zabbix_utils.exceptions import APIRequestError +from zabbix_utils.exceptions import APIRequestError, ProcessingError from homeassistant.const import ( CONF_HOST, @@ -282,6 +282,8 @@ def write_to_zabbix(self, metrics: list[ItemValue]) -> None: if not self.write_errors: _LOGGER.error("Write error: %s", err) self.write_errors += len(metrics) + except ProcessingError as prerr: + _LOGGER.error("Error writing to Zabbix: %s", prerr) def run(self) -> None: """Process incoming events.""" diff --git a/requirements_all.txt b/requirements_all.txt index 11c2f3d3787cc..6e949c7a7f43f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -247,7 +247,7 @@ aioelectricitymaps==0.4.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==34.1.0 +aioesphomeapi==34.2.0 # homeassistant.components.flo aioflo==2021.11.0 @@ -301,7 +301,7 @@ aiolifx-effects==0.3.2 aiolifx-themes==0.6.4 # homeassistant.components.lifx -aiolifx==1.2.0 +aiolifx==1.2.1 # homeassistant.components.lookin aiolookin==1.0.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index eb03b87f5ccdd..820f681a84121 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -235,7 +235,7 @@ aioelectricitymaps==0.4.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==34.1.0 +aioesphomeapi==34.2.0 # homeassistant.components.flo aioflo==2021.11.0 @@ -283,7 +283,7 @@ aiolifx-effects==0.3.2 aiolifx-themes==0.6.4 # homeassistant.components.lifx -aiolifx==1.2.0 +aiolifx==1.2.1 # homeassistant.components.lookin aiolookin==1.0.0 diff --git a/tests/components/openai_conversation/test_config_flow.py b/tests/components/openai_conversation/test_config_flow.py index b77542fbab31c..e845828570c38 100644 --- a/tests/components/openai_conversation/test_config_flow.py +++ b/tests/components/openai_conversation/test_config_flow.py @@ -286,29 +286,6 @@ async def test_form_invalid_auth(hass: HomeAssistant, side_effect, error) -> Non CONF_PROMPT: "", }, ), - ( # options with no model-specific settings - {}, - ( - { - CONF_RECOMMENDED: False, - CONF_PROMPT: "Speak like a pirate", - }, - { - CONF_TEMPERATURE: 1.0, - CONF_CHAT_MODEL: "gpt-4.5-preview", - CONF_TOP_P: RECOMMENDED_TOP_P, - CONF_MAX_TOKENS: RECOMMENDED_MAX_TOKENS, - }, - ), - { - CONF_RECOMMENDED: False, - CONF_PROMPT: "Speak like a pirate", - CONF_TEMPERATURE: 1.0, - CONF_CHAT_MODEL: "gpt-4.5-preview", - CONF_TOP_P: RECOMMENDED_TOP_P, - CONF_MAX_TOKENS: RECOMMENDED_MAX_TOKENS, - }, - ), ( # options for reasoning models {}, ( diff --git a/tests/components/xiaomi_ble/test_sensor.py b/tests/components/xiaomi_ble/test_sensor.py index f5625d4e74d0f..3540c92682bac 100644 --- a/tests/components/xiaomi_ble/test_sensor.py +++ b/tests/components/xiaomi_ble/test_sensor.py @@ -700,7 +700,7 @@ async def test_miscale_v1_uuid(hass: HomeAssistant) -> None: assert mass_non_stabilized_sensor.state == "86.55" assert ( mass_non_stabilized_sensor_attr[ATTR_FRIENDLY_NAME] - == "Mi Smart Scale (B5DC) Weight non stabilized" + == "Mi Smart Scale (B5DC) Weight non-stabilized" ) assert mass_non_stabilized_sensor_attr[ATTR_UNIT_OF_MEASUREMENT] == "kg" assert mass_non_stabilized_sensor_attr[ATTR_STATE_CLASS] == "measurement" @@ -742,7 +742,7 @@ async def test_miscale_v2_uuid(hass: HomeAssistant) -> None: assert mass_non_stabilized_sensor.state == "85.15" assert ( mass_non_stabilized_sensor_attr[ATTR_FRIENDLY_NAME] - == "Mi Body Composition Scale (B5DC) Weight non stabilized" + == "Mi Body Composition Scale (B5DC) Weight non-stabilized" ) assert mass_non_stabilized_sensor_attr[ATTR_UNIT_OF_MEASUREMENT] == "kg" assert mass_non_stabilized_sensor_attr[ATTR_STATE_CLASS] == "measurement"