diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index e38671ae912..5d2070b9015 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -87,10 +87,12 @@ PLATFORMS = [ class TuyaDeviceClass(StrEnum): """Tuya specific device classes, used for translations.""" + AIR_QUALITY = "tuya__air_quality" CURTAIN_MODE = "tuya__curtain_mode" CURTAIN_MOTOR_MODE = "tuya__curtain_motor_mode" BASIC_ANTI_FLICKR = "tuya__basic_anti_flickr" BASIC_NIGHTVISION = "tuya__basic_nightvision" + COUNTDOWN = "tuya__countdown" DECIBEL_SENSITIVITY = "tuya__decibel_sensitivity" FAN_ANGLE = "tuya__fan_angle" FINGERBOT_MODE = "tuya__fingerbot_mode" @@ -132,6 +134,7 @@ class DPCode(StrEnum): https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq """ + AIR_QUALITY = "air_quality" ALARM_SWITCH = "alarm_switch" # Alarm switch ALARM_TIME = "alarm_time" # Alarm time ALARM_VOLUME = "alarm_volume" # Alarm volume @@ -207,6 +210,7 @@ class DPCode(StrEnum): DOORCONTACT_STATE_2 = "doorcontact_state_2" DOORCONTACT_STATE_3 = "doorcontact_state_3" DUSTER_CLOTH = "duster_cloth" + ECO2 = "eco2" EDGE_BRUSH = "edge_brush" ELECTRICITY_LEFT = "electricity_left" FAN_BEEP = "fan_beep" # Sound @@ -222,6 +226,7 @@ class DPCode(StrEnum): FAULT = "fault" FEED_REPORT = "feed_report" FEED_STATE = "feed_state" + FILTER = "filter" FILTER_LIFE = "filter" FILTER_RESET = "filter_reset" # Filter (cartridge) reset FLOODLIGHT_LIGHTNESS = "floodlight_lightness" @@ -231,6 +236,7 @@ class DPCode(StrEnum): GAS_SENSOR_STATUS = "gas_sensor_status" GAS_SENSOR_VALUE = "gas_sensor_value" HUMIDIFIER = "humidifier" # Humidification + HUMIDITY = "humidity" # Humidity HUMIDITY_CURRENT = "humidity_current" # Current humidity HUMIDITY_SET = "humidity_set" # Humidity setting HUMIDITY_VALUE = "humidity_value" # Humidity @@ -269,6 +275,7 @@ class DPCode(StrEnum): PIR = "pir" # Motion sensor PM1 = "pm1" PM10 = "pm10" + PM25 = "pm25" PM25_STATE = "pm25_state" PM25_VALUE = "pm25_value" POWDER_SET = "powder_set" # Powder @@ -352,6 +359,9 @@ class DPCode(StrEnum): TOTAL_CLEAN_COUNT = "total_clean_count" TOTAL_CLEAN_TIME = "total_clean_time" TOTAL_FORWARD_ENERGY = "total_forward_energy" + TOTAL_TIME = "total_time" + TOTAL_PM = "total_pm" + TVOC = "tvoc" UV = "uv" # UV sterilization VA_BATTERY = "va_battery" VA_HUMIDITY = "va_humidity" diff --git a/homeassistant/components/tuya/select.py b/homeassistant/components/tuya/select.py index 5154afb9ab5..b0b7aeec2be 100644 --- a/homeassistant/components/tuya/select.py +++ b/homeassistant/components/tuya/select.py @@ -274,6 +274,24 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = { entity_category=EntityCategory.CONFIG, ), ), + # Air Purifier + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46h2s6dzm + "kj": ( + SelectEntityDescription( + key=DPCode.COUNTDOWN, + name="Countdown", + device_class=TuyaDeviceClass.COUNTDOWN, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + ), + SelectEntityDescription( + key=DPCode.COUNTDOWN_SET, + name="Countdown", + device_class=TuyaDeviceClass.COUNTDOWN, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + ), + ), } # Socket (duplicate of `kg`) diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index 06c4a783066..e415d26ad4c 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -742,6 +742,67 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = { icon="mdi:progress-clock", ), ), + # Air Purifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r41mn81 + "kj": ( + TuyaSensorEntityDescription( + key=DPCode.FILTER, + name="Filter Utilization", + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:ticket-percent-outline", + ), + TuyaSensorEntityDescription( + key=DPCode.PM25, + name="Particulate Matter 2.5 µm", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:molecule", + ), + TuyaSensorEntityDescription( + key=DPCode.TEMP, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.HUMIDITY, + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.TVOC, + name="Total Volatile Organic Compound", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.ECO2, + name="Concentration of Carbon Dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.TOTAL_TIME, + name="Total Operating Time", + icon="mdi:history", + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + TuyaSensorEntityDescription( + key=DPCode.TOTAL_PM, + name="Total Absorption of Particles", + icon="mdi:texture-box", + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + TuyaSensorEntityDescription( + key=DPCode.AIR_QUALITY, + name="Air quality", + icon="mdi:air-filter", + device_class=TuyaDeviceClass.AIR_QUALITY, + ), + ), } # Socket (duplicate of `kg`) @@ -845,6 +906,10 @@ class TuyaSensorEntity(TuyaEntity, SensorEntity): self._attr_device_class = None return + # If we still have a device class, we should not use an icon + if self.device_class: + self._attr_icon = None + # Found unit of measurement, use the standardized Unit # Use the target conversion unit (if set) self._attr_native_unit_of_measurement = ( diff --git a/homeassistant/components/tuya/strings.select.json b/homeassistant/components/tuya/strings.select.json index c1171f81fcb..ada9c528ac8 100644 --- a/homeassistant/components/tuya/strings.select.json +++ b/homeassistant/components/tuya/strings.select.json @@ -93,6 +93,15 @@ "tuya__curtain_motor_mode": { "forward": "Forward", "back": "Back" + }, + "tuya__countdown": { + "cancel": "Cancel", + "1h": "1 hour", + "2h": "2 hours", + "3h": "3 hours", + "4h": "4 hours", + "5h": "5 hours", + "6h": "6 hours" } } } diff --git a/homeassistant/components/tuya/strings.sensor.json b/homeassistant/components/tuya/strings.sensor.json index ff246817f61..a11aadba321 100644 --- a/homeassistant/components/tuya/strings.sensor.json +++ b/homeassistant/components/tuya/strings.sensor.json @@ -10,6 +10,12 @@ "reserve_3": "Reserve 3", "standby": "Standby", "warm": "Heat preservation" + }, + "tuya__air_quality": { + "great": "Great", + "mild": "Mild", + "good": "Good", + "severe": "Severe" } } } diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index 4559bdf3364..ae63830bd8d 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -198,6 +198,12 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { icon="mdi:water-percent", entity_category=EntityCategory.CONFIG, ), + SwitchEntityDescription( + key=DPCode.UV, + name="UV Sterilization", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), ), # Air conditioner # https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n