Skip to content

Commit 4cc25f9

Browse files
committed
Ensure correct precedence and add docstrings.
1 parent f8fc831 commit 4cc25f9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

zha/application/platforms/light/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,8 @@ class HueLight(Light):
10011001
manufacturers={"Philips", "Signify Netherlands B.V."},
10021002
)
10031003
class HueEffectLight(HueLight):
1004+
"""Specialization of a HUE light with effects."""
1005+
10041006
# Supported effects and their ID used in commands
10051007
HUE_EFFECTS = {"candle": 1, "fireplace": 2, "prism": 3}
10061008

@@ -1020,6 +1022,7 @@ def __init__(
10201022
self._effect_list.extend(self.HUE_EFFECTS.keys())
10211023

10221024
async def async_turn_on(self, **kwargs: Any) -> None:
1025+
"""Turn the entity on."""
10231026
# If only change of brightness is requested, the effect doesn't have to be interupted
10241027
if kwargs.get(ATTR_BRIGHTNESS) is not None and all(
10251028
attr == ATTR_BRIGHTNESS or kwargs.get(attr) is None for attr in kwargs
@@ -1040,8 +1043,8 @@ async def async_turn_on(self, **kwargs: Any) -> None:
10401043
)
10411044
self._effect = effect
10421045
elif (
1043-
effect is None or effect == EFFECT_OFF and self._effect in self.HUE_EFFECTS
1044-
):
1046+
effect is None or effect == EFFECT_OFF
1047+
) and self._effect in self.HUE_EFFECTS:
10451048
# Only stop effect if it was started by us
10461049
# Following command will stop the effect while preserving brightness
10471050
await self._hue_cluster.multicolor(data=bytearray([0x20, 0x00, 0x00, 0x00]))

0 commit comments

Comments
 (0)