From 5fc2897c084ad6106dcf1d1594d1d3b3c3291dca Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 20 Oct 2021 18:24:34 +0200 Subject: [PATCH] Complete Ceiling Light (xdd) device support for Tuya (#58095) --- homeassistant/components/tuya/const.py | 2 ++ homeassistant/components/tuya/light.py | 6 +++++- homeassistant/components/tuya/switch.py | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index f0a1d92c58c..9fc6a30e80c 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -150,6 +150,7 @@ class DPCode(str, Enum): CUR_POWER = "cur_power" # Actual power CUR_VOLTAGE = "cur_voltage" # Actual voltage DEHUMIDITY_SET_VALUE = "dehumidify_set_value" + DO_NOT_DISTURB = "do_not_disturb" DOORCONTACT_STATE = "doorcontact_state" # Status of door window sensor DOORCONTACT_STATE_2 = "doorcontact_state_3" DOORCONTACT_STATE_3 = "doorcontact_state_3" @@ -208,6 +209,7 @@ class DPCode(str, Enum): SWITCH_LED = "switch_led" # Switch SWITCH_LED_1 = "switch_led_1" SWITCH_LED_2 = "switch_led_2" + SWITCH_NIGHT_LIGHT = "switch_night_light" SWITCH_SPRAY = "switch_spray" # Spraying switch SWITCH_USB1 = "switch_usb1" # USB 1 SWITCH_USB2 = "switch_usb2" # USB 2 diff --git a/homeassistant/components/tuya/light.py b/homeassistant/components/tuya/light.py index ba0710c390c..c22050eb85e 100644 --- a/homeassistant/components/tuya/light.py +++ b/homeassistant/components/tuya/light.py @@ -130,7 +130,7 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { color_data=DPCode.COLOUR_DATA, ), ), - # Ceiling Light + # Ceiling Light # https://developer.tuya.com/en/docs/iot/ceiling-light?id=Kaiuz03xxfc4r "xdd": ( TuyaLightEntityDescription( @@ -140,6 +140,10 @@ LIGHTS: dict[str, tuple[TuyaLightEntityDescription, ...]] = { color_temp=DPCode.TEMP_VALUE, color_data=DPCode.COLOUR_DATA, ), + TuyaLightEntityDescription( + key=DPCode.SWITCH_NIGHT_LIGHT, + name="Night Light", + ), ), # Remote Control # https://developer.tuya.com/en/docs/iot/ykq?id=Kaof8ljn81aov diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py index d4dddb5910a..2201ce30539 100644 --- a/homeassistant/components/tuya/switch.py +++ b/homeassistant/components/tuya/switch.py @@ -256,6 +256,16 @@ SWITCHES: dict[str, tuple[SwitchEntityDescription, ...]] = { entity_category=ENTITY_CATEGORY_CONFIG, ), ), + # Ceiling Light + # https://developer.tuya.com/en/docs/iot/ceiling-light?id=Kaiuz03xxfc4r + "xdd": ( + SwitchEntityDescription( + key=DPCode.DO_NOT_DISTURB, + name="Do not disturb", + icon="mdi:minus-circle-outline", + entity_category=ENTITY_CATEGORY_CONFIG, + ), + ), # Diffuser # https://developer.tuya.com/en/docs/iot/categoryxxj?id=Kaiuz1f9mo6bl "xxj": (