Complementing the Tuya Air Purifier (kj) category (#65283)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
b9d7d0cae2
commit
92842b796b
6 changed files with 114 additions and 0 deletions
|
@ -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"
|
||||
|
|
|
@ -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`)
|
||||
|
|
|
@ -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 = (
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
"reserve_3": "Reserve 3",
|
||||
"standby": "Standby",
|
||||
"warm": "Heat preservation"
|
||||
},
|
||||
"tuya__air_quality": {
|
||||
"great": "Great",
|
||||
"mild": "Mild",
|
||||
"good": "Good",
|
||||
"severe": "Severe"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue