From 6f0c1d23451140db205065dc4bf88bc3e44e1998 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 24 Oct 2021 11:46:46 +0200 Subject: [PATCH] Complete Solar Light (tyndj) device support to Tuya (#58302) --- homeassistant/components/tuya/const.py | 1 + homeassistant/components/tuya/sensor.py | 3 +++ homeassistant/components/tuya/switch.py | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index 0cf46390601..75589573042 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -269,6 +269,7 @@ class DPCode(str, Enum): SWITCH_LED_2 = "switch_led_2" SWITCH_LED_3 = "switch_led_3" SWITCH_NIGHT_LIGHT = "switch_night_light" + SWITCH_SAVE_ENERGY = "switch_save_energy" SWITCH_SPRAY = "switch_spray" # Spraying switch SWITCH_USB1 = "switch_usb1" # USB 1 SWITCH_USB2 = "switch_usb2" # USB 2 diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index f67d8f1c242..077b7803031 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -261,6 +261,9 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = { state_class=STATE_CLASS_MEASUREMENT, ), ), + # Solar Light + # https://developer.tuya.com/en/docs/iot/tynd?id=Kaof8j02e1t98 + "tyndj": BATTERY_SENSORS, # Pressure Sensor # https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm "ylcg": ( diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index 95688f7dc78..1a37af30e2b 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -353,6 +353,16 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { entity_category=ENTITY_CATEGORY_CONFIG, ), ), + # Solar Light + # https://developer.tuya.com/en/docs/iot/tynd?id=Kaof8j02e1t98 + "tyndj": ( + SwitchEntityDescription( + key=DPCode.SWITCH_SAVE_ENERGY, + name="Energy Saving", + icon="mdi:leaf", + entity_category=ENTITY_CATEGORY_CONFIG, + ), + ), # Ceiling Light # https://developer.tuya.com/en/docs/iot/ceiling-light?id=Kaiuz03xxfc4r "xdd": (