From 52d7ca6b1c196d3564f2d6d1372df870f2a3e023 Mon Sep 17 00:00:00 2001 From: dougiteixeira <31328123+dougiteixeira@users.noreply.github.com> Date: Sat, 5 Feb 2022 16:31:20 -0300 Subject: [PATCH] Complementing the Tuya Humidifier (jsq) category (#65276) Co-authored-by: Franck Nijhof --- homeassistant/components/tuya/const.py | 9 +++++ homeassistant/components/tuya/number.py | 14 +++++++ homeassistant/components/tuya/select.py | 39 +++++++++++++++++++ homeassistant/components/tuya/sensor.py | 28 +++++++++++++ .../components/tuya/strings.select.json | 26 +++++++++++++ homeassistant/components/tuya/switch.py | 22 +++++++++++ 6 files changed, 138 insertions(+) diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index 5d2070b9015..d976bee2792 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -96,6 +96,9 @@ class TuyaDeviceClass(StrEnum): DECIBEL_SENSITIVITY = "tuya__decibel_sensitivity" FAN_ANGLE = "tuya__fan_angle" FINGERBOT_MODE = "tuya__fingerbot_mode" + HUMIDIFIER_SPRAY_MODE = "tuya__humidifier_spray_mode" + HUMIDIFIER_LEVEL = "tuya__humidifier_level" + HUMIDIFIER_MOODLIGHTING = "tuya__humidifier_moodlighting" IPC_WORK_MODE = "tuya__ipc_work_mode" LED_TYPE = "tuya__led_type" LIGHT_MODE = "tuya__light_mode" @@ -245,6 +248,7 @@ class DPCode(StrEnum): LED_TYPE_2 = "led_type_2" LED_TYPE_3 = "led_type_3" LEVEL = "level" + LEVEL_CURRENT = "level_current" LIGHT = "light" # Light LIGHT_MODE = "light_mode" LOCK = "lock" # Lock / Child lock @@ -253,6 +257,7 @@ class DPCode(StrEnum): MANUAL_FEED = "manual_feed" MATERIAL = "material" # Material MODE = "mode" # Working mode / Mode + MOODLIGHTING = "moodlighting" # Mood light MOTION_RECORD = "motion_record" MOTION_SENSITIVITY = "motion_sensitivity" MOTION_SWITCH = "motion_switch" # Motion switch @@ -303,6 +308,7 @@ class DPCode(StrEnum): SHOCK_STATE = "shock_state" # Vibration status SIREN_SWITCH = "siren_switch" SITUATION_SET = "situation_set" + SLEEP = "sleep" # Sleep function SLOW_FEED = "slow_feed" SMOKE_SENSOR_STATE = "smoke_sensor_state" SMOKE_SENSOR_STATUS = "smoke_sensor_status" @@ -310,8 +316,10 @@ class DPCode(StrEnum): SOS = "sos" # Emergency State SOS_STATE = "sos_state" # Emergency mode SPEED = "speed" # Speed level + SPRAY_MODE = "spray_mode" # Spraying mode START = "start" # Start STATUS = "status" + STERILIZATION = "sterilization" # Sterilization SUCTION = "suction" SWING = "swing" # Swing mode SWITCH = "switch" # Switch @@ -333,6 +341,7 @@ class DPCode(StrEnum): SWITCH_LED_3 = "switch_led_3" SWITCH_NIGHT_LIGHT = "switch_night_light" SWITCH_SAVE_ENERGY = "switch_save_energy" + SWITCH_SOUND = "switch_sound" # Voice switch SWITCH_SPRAY = "switch_spray" # Spraying switch SWITCH_USB1 = "switch_usb1" # USB 1 SWITCH_USB2 = "switch_usb2" # USB 2 diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index d234b6778be..d9cde61a276 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -250,6 +250,20 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { icon="mdi:thermometer-lines", ), ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + NumberEntityDescription( + key=DPCode.TEMP_SET, + name="Temperature", + icon="mdi:thermometer-lines", + ), + NumberEntityDescription( + key=DPCode.TEMP_SET_F, + name="Temperature", + icon="mdi:thermometer-lines", + ), + ), } diff --git a/homeassistant/components/tuya/select.py b/homeassistant/components/tuya/select.py index a3e1d0439ae..d9103b916f4 100644 --- a/homeassistant/components/tuya/select.py +++ b/homeassistant/components/tuya/select.py @@ -276,6 +276,45 @@ SELECTS: dict[str, tuple[SelectEntityDescription, ...]] = { entity_category=EntityCategory.CONFIG, ), ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + SelectEntityDescription( + key=DPCode.SPRAY_MODE, + name="Spray Mode", + device_class=TuyaDeviceClass.HUMIDIFIER_SPRAY_MODE, + entity_category=EntityCategory.CONFIG, + icon="mdi:spray", + ), + SelectEntityDescription( + key=DPCode.LEVEL, + name="Spraying Level", + device_class=TuyaDeviceClass.HUMIDIFIER_LEVEL, + entity_category=EntityCategory.CONFIG, + icon="mdi:spray", + ), + SelectEntityDescription( + key=DPCode.MOODLIGHTING, + name="Moodlighting", + device_class=TuyaDeviceClass.HUMIDIFIER_MOODLIGHTING, + entity_category=EntityCategory.CONFIG, + icon="mdi:lightbulb-multiple", + ), + 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", + ), + ), # Air Purifier # https://developer.tuya.com/en/docs/iot/f?id=K9gf46h2s6dzm "kj": ( diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index effb5a1443b..7fcea1095d4 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -742,6 +742,34 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = { icon="mdi:progress-clock", ), ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48qwjz0i3 + "jsq": ( + TuyaSensorEntityDescription( + key=DPCode.HUMIDITY_CURRENT, + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.TEMP_CURRENT, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.TEMP_CURRENT_F, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + TuyaSensorEntityDescription( + key=DPCode.LEVEL_CURRENT, + name="Water Level", + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:waves-arrow-up", + ), + ), # Air Purifier # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r41mn81 "kj": ( diff --git a/homeassistant/components/tuya/strings.select.json b/homeassistant/components/tuya/strings.select.json index ada9c528ac8..a765912d036 100644 --- a/homeassistant/components/tuya/strings.select.json +++ b/homeassistant/components/tuya/strings.select.json @@ -102,6 +102,32 @@ "4h": "4 hours", "5h": "5 hours", "6h": "6 hours" + }, + "tuya__humidifier_spray_mode": { + "auto": "Auto", + "health": "Health", + "sleep": "Sleep", + "humidity": "Humidity", + "work": "Work" + }, + "tuya__humidifier_level": { + "level_1": "Level 1", + "level_2": "Level 2", + "level_3": "Level 3", + "level_4": "Level 4", + "level_5": "Level 5", + "level_6": "Level 6", + "level_7": "Level 7", + "level_8": "Level 8", + "level_9": "Level 9", + "level_10": "Level 10" + }, + "tuya__humidifier_moodlighting": { + "1": "Mood 1", + "2": "Mood 2", + "3": "Mood 3", + "4": "Mood 4", + "5": "Mood 5" } } } diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index ae63830bd8d..fc3d8d86baf 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -558,6 +558,28 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { entity_category=EntityCategory.CONFIG, ), ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + SwitchEntityDescription( + key=DPCode.SWITCH_SOUND, + name="Voice", + icon="mdi:account-voice", + entity_category=EntityCategory.CONFIG, + ), + SwitchEntityDescription( + key=DPCode.SLEEP, + name="Sleep", + icon="mdi:power-sleep", + entity_category=EntityCategory.CONFIG, + ), + SwitchEntityDescription( + key=DPCode.STERILIZATION, + name="Sterilization", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), + ), } # Socket (duplicate of `pc`)