From 4ac7dfc983ac0d6a05efbad6d18ee0ff4ff53545 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Mon, 8 Nov 2021 21:46:23 +0200 Subject: [PATCH] Cleanup Shelly light - use separate sets for dual mode and effects (#59363) --- homeassistant/components/shelly/__init__.py | 4 +++- homeassistant/components/shelly/const.py | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/shelly/__init__.py b/homeassistant/components/shelly/__init__.py index 6a981ab2b86..ca690e33361 100644 --- a/homeassistant/components/shelly/__init__.py +++ b/homeassistant/components/shelly/__init__.py @@ -45,6 +45,7 @@ from .const import ( ENTRY_RELOAD_COOLDOWN, EVENT_SHELLY_CLICK, INPUTS_EVENTS_DICT, + MODELS_SUPPORTING_LIGHT_EFFECTS, POLLING_TIMEOUT_SEC, REST, REST_SENSORS_UPDATE_INTERVAL, @@ -313,11 +314,12 @@ class BlockDeviceWrapper(update_coordinator.DataUpdateCoordinator): # For dual mode bulbs ignore change if it is due to mode/effect change if self.model in DUAL_MODE_LIGHT_MODELS: - if "mode" in block.sensor_ids and self.model != "SHRGBW2": + if "mode" in block.sensor_ids: if self._last_mode != block.mode: self._last_cfg_changed = None self._last_mode = block.mode + if self.model in MODELS_SUPPORTING_LIGHT_EFFECTS: if "effect" in block.sensor_ids: if self._last_effect != block.effect: self._last_cfg_changed = None diff --git a/homeassistant/components/shelly/const.py b/homeassistant/components/shelly/const.py index 5fceb64e65c..d241998a138 100644 --- a/homeassistant/components/shelly/const.py +++ b/homeassistant/components/shelly/const.py @@ -35,14 +35,18 @@ MODELS_SUPPORTING_LIGHT_TRANSITION: Final = ( "SHVIN-1", ) -# Bulbs that support white & color modes -DUAL_MODE_LIGHT_MODELS: Final = ( - "SHBDUO-1", +MODELS_SUPPORTING_LIGHT_EFFECTS: Final = ( "SHBLB-1", "SHCB-1", "SHRGBW2", ) +# Bulbs that support white & color modes +DUAL_MODE_LIGHT_MODELS: Final = ( + "SHBLB-1", + "SHCB-1", +) + # Used in "_async_update_data" as timeout for polling data from devices. POLLING_TIMEOUT_SEC: Final = 18