From 722d3862dbd91334a284e7448184b8b57d51424f Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Sat, 9 Oct 2021 02:22:14 +0300 Subject: [PATCH] Fix Shelly RGB/W supported color mode detection (#57359) --- homeassistant/components/shelly/const.py | 5 +++++ homeassistant/components/shelly/light.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/shelly/const.py b/homeassistant/components/shelly/const.py index 3c9c24b1f7f..a6f3ab12c6b 100644 --- a/homeassistant/components/shelly/const.py +++ b/homeassistant/components/shelly/const.py @@ -21,6 +21,11 @@ LIGHT_TRANSITION_MIN_FIRMWARE_DATE: Final = 20210226 # max light transition time in milliseconds MAX_TRANSITION_TIME: Final = 5000 +RGBW_MODELS: Final = ( + "SHBLB-1", + "SHRGBW2", +) + MODELS_SUPPORTING_LIGHT_TRANSITION: Final = ( "SHBDUO-1", "SHCB-1", diff --git a/homeassistant/components/shelly/light.py b/homeassistant/components/shelly/light.py index cd034c1e7e5..3e0fce43681 100644 --- a/homeassistant/components/shelly/light.py +++ b/homeassistant/components/shelly/light.py @@ -46,6 +46,7 @@ from .const import ( LIGHT_TRANSITION_MIN_FIRMWARE_DATE, MAX_TRANSITION_TIME, MODELS_SUPPORTING_LIGHT_TRANSITION, + RGBW_MODELS, RPC, SHBLB_1_RGB_EFFECTS, STANDARD_RGB_EFFECTS, @@ -143,7 +144,7 @@ class BlockShellyLight(ShellyBlockEntity, LightEntity): if hasattr(block, "red") and hasattr(block, "green") and hasattr(block, "blue"): self._min_kelvin = KELVIN_MIN_VALUE_COLOR - if hasattr(block, "white"): + if wrapper.model in RGBW_MODELS: self._supported_color_modes.add(COLOR_MODE_RGBW) else: self._supported_color_modes.add(COLOR_MODE_RGB)