From 0a00c77ed6a705faae79743db0dd839122a6be3b Mon Sep 17 00:00:00 2001 From: vauriga <77296558+vauriga@users.noreply.github.com> Date: Tue, 4 Jan 2022 16:00:48 +0100 Subject: [PATCH] Add support for Pet Feeder (cwwsq) in Tuya (#61359) --- homeassistant/components/tuya/binary_sensor.py | 10 ++++++++++ homeassistant/components/tuya/const.py | 5 +++++ homeassistant/components/tuya/number.py | 14 ++++++++++++++ homeassistant/components/tuya/sensor.py | 10 ++++++++++ homeassistant/components/tuya/switch.py | 10 ++++++++++ 5 files changed, 49 insertions(+) diff --git a/homeassistant/components/tuya/binary_sensor.py b/homeassistant/components/tuya/binary_sensor.py index c9a1ab598c3..7142949f0c6 100644 --- a/homeassistant/components/tuya/binary_sensor.py +++ b/homeassistant/components/tuya/binary_sensor.py @@ -71,6 +71,16 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = { ), TAMPER_BINARY_SENSOR, ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + TuyaBinarySensorEntityDescription( + key=DPCode.FEED_STATE, + name="Feeding", + icon="mdi:information", + on_value="feeding", + ), + ), # Human Presence Sensor # https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs "hps": ( diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index d1875f14811..c8fe6c07a95 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -189,6 +189,8 @@ class DPCode(StrEnum): FAN_SPEED_PERCENT = "fan_speed_percent" # Stepless speed FAR_DETECTION = "far_detection" FAULT = "fault" + FEED_REPORT = "feed_report" + FEED_STATE = "feed_state" FILTER_LIFE = "filter" FILTER_RESET = "filter_reset" # Filter (cartridge) reset FLOODLIGHT_LIGHTNESS = "floodlight_lightness" @@ -209,6 +211,7 @@ class DPCode(StrEnum): LIGHT_MODE = "light_mode" LOCK = "lock" # Lock / Child lock MACH_OPERATE = "mach_operate" + MANUAL_FEED = "manual_feed" MATERIAL = "material" # Material MODE = "mode" # Working mode / Mode MOTION_RECORD = "motion_record" @@ -257,6 +260,7 @@ class DPCode(StrEnum): SHOCK_STATE = "shock_state" # Vibration status SIREN_SWITCH = "siren_switch" SITUATION_SET = "situation_set" + SLOW_FEED = "slow_feed" SMOKE_SENSOR_STATE = "smoke_sensor_state" SMOKE_SENSOR_STATUS = "smoke_sensor_status" SMOKE_SENSOR_VALUE = "smoke_sensor_value" @@ -315,6 +319,7 @@ class DPCode(StrEnum): VOC_STATE = "voc_state" VOC_VALUE = "voc_value" VOICE_SWITCH = "voice_switch" + VOICE_TIMES = "voice_times" VOLUME_SET = "volume_set" WARM = "warm" # Heat preservation WARM_TIME = "warm_time" # Heat preservation time diff --git a/homeassistant/components/tuya/number.py b/homeassistant/components/tuya/number.py index 4a13db72976..a98635ef68c 100644 --- a/homeassistant/components/tuya/number.py +++ b/homeassistant/components/tuya/number.py @@ -55,6 +55,20 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = { entity_category=EntityCategory.CONFIG, ), ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + NumberEntityDescription( + key=DPCode.MANUAL_FEED, + name="Feed", + icon="mdi:bowl", + ), + NumberEntityDescription( + key=DPCode.VOICE_TIMES, + name="Voice Times", + icon="mdi:microphone", + ), + ), # Human Presence Sensor # https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs "hps": ( diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index 4aa88294bda..b738ae75cd0 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -137,6 +137,16 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = { ), *BATTERY_SENSORS, ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + TuyaSensorEntityDescription( + key=DPCode.FEED_REPORT, + name="Last Amount", + icon="mdi:counter", + state_class=SensorStateClass.MEASUREMENT, + ), + ), # Air Quality Monitor # No specification on Tuya portal "hjjcy": ( diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index c8cd12c94b4..3085b7f439a 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -38,6 +38,16 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { entity_category=EntityCategory.CONFIG, ), ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + SwitchEntityDescription( + key=DPCode.SLOW_FEED, + name="Slow Feed", + icon="mdi:speedometer-slow", + entity_category=EntityCategory.CONFIG, + ), + ), # Pet Water Feeder # https://developer.tuya.com/en/docs/iot/f?id=K9gf46aewxem5 "cwysj": (