From 5af496682b71ef22c90ea9ac9ef6c712ba59ee0e Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 26 Apr 2022 14:29:56 +0200 Subject: [PATCH] Use light enums in shelly (#70790) --- homeassistant/components/shelly/light.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/shelly/light.py b/homeassistant/components/shelly/light.py index ff67a38d85e..3530241f102 100644 --- a/homeassistant/components/shelly/light.py +++ b/homeassistant/components/shelly/light.py @@ -12,10 +12,9 @@ from homeassistant.components.light import ( ATTR_RGB_COLOR, ATTR_RGBW_COLOR, ATTR_TRANSITION, - SUPPORT_EFFECT, - SUPPORT_TRANSITION, ColorMode, LightEntity, + LightEntityFeature, brightness_supported, ) from homeassistant.config_entries import ConfigEntry @@ -158,7 +157,7 @@ class BlockShellyLight(ShellyBlockEntity, LightEntity): self._attr_supported_color_modes.add(ColorMode.ONOFF) if hasattr(block, "effect"): - self._attr_supported_features |= SUPPORT_EFFECT + self._attr_supported_features |= LightEntityFeature.EFFECT if wrapper.model in MODELS_SUPPORTING_LIGHT_TRANSITION: match = FIRMWARE_PATTERN.search(wrapper.device.settings.get("fw", "")) @@ -166,7 +165,7 @@ class BlockShellyLight(ShellyBlockEntity, LightEntity): match is not None and int(match[0]) >= LIGHT_TRANSITION_MIN_FIRMWARE_DATE ): - self._attr_supported_features |= SUPPORT_TRANSITION + self._attr_supported_features |= LightEntityFeature.TRANSITION @property def is_on(self) -> bool: @@ -264,7 +263,7 @@ class BlockShellyLight(ShellyBlockEntity, LightEntity): @property def effect_list(self) -> list[str] | None: """Return the list of supported effects.""" - if not self.supported_features & SUPPORT_EFFECT: + if not self.supported_features & LightEntityFeature.EFFECT: return None if self.wrapper.model == "SHBLB-1": @@ -275,7 +274,7 @@ class BlockShellyLight(ShellyBlockEntity, LightEntity): @property def effect(self) -> str | None: """Return the current effect.""" - if not self.supported_features & SUPPORT_EFFECT: + if not self.supported_features & LightEntityFeature.EFFECT: return None if self.control_result: