Cleanup Shelly light - use separate sets for dual mode and effects (#59363)

pull/59380/head
Shay Levy 2021-11-08 21:46:23 +02:00 committed by GitHub
parent ac354ecff5
commit 4ac7dfc983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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