Skip to content

Commit

Permalink
Change cluster name to match dev.
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaRavener committed Feb 12, 2025
1 parent 4cc25f9 commit e5b8630
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions zha/application/platforms/light/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
CLUSTER_HANDLER_LEVEL,
CLUSTER_HANDLER_LEVEL_CHANGED,
CLUSTER_HANDLER_ON_OFF,
CLUSTER_HANDLER_PHILIPS_HUE_LIGHT,
)
from zha.zigbee.cluster_handlers.general import LevelChangeEvent

Expand Down Expand Up @@ -996,7 +997,7 @@ class HueLight(Light):
aux_cluster_handlers={
CLUSTER_HANDLER_COLOR,
CLUSTER_HANDLER_LEVEL,
"philips_hue_cluster",
CLUSTER_HANDLER_PHILIPS_HUE_LIGHT,
},
manufacturers={"Philips", "Signify Netherlands B.V."},
)
Expand All @@ -1018,14 +1019,16 @@ def __init__(
) -> None:
"""Initialize the ZHA light."""
super().__init__(unique_id, cluster_handlers, endpoint, device, **kwargs)
self._hue_cluster = self.cluster_handlers.get("philips_hue_cluster")
self._hue_light_cluster = self.cluster_handlers.get(
CLUSTER_HANDLER_PHILIPS_HUE_LIGHT
)
self._effect_list.extend(self.HUE_EFFECTS.keys())

async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the entity on."""
# If only change of brightness is requested, the effect doesn't have to be interupted
if kwargs.get(ATTR_BRIGHTNESS) is not None and all(
attr == ATTR_BRIGHTNESS or kwargs.get(attr) is None for attr in kwargs
kwargs.get(attr) is None for attr in (kwargs.keys() - {ATTR_BRIGHTNESS})
):
effect = self._effect
else:
Expand All @@ -1038,7 +1041,7 @@ async def async_turn_on(self, **kwargs: Any) -> None:

if effect in self.HUE_EFFECTS:
effect_id = self.HUE_EFFECTS[effect]
await self._hue_cluster.multicolor(
await self._hue_light_cluster.multicolor(
data=bytearray([0x22, 0x00, self._brightness, effect_id])
)
self._effect = effect
Expand All @@ -1047,7 +1050,9 @@ async def async_turn_on(self, **kwargs: Any) -> None:
) and self._effect in self.HUE_EFFECTS:
# Only stop effect if it was started by us
# Following command will stop the effect while preserving brightness
await self._hue_cluster.multicolor(data=bytearray([0x20, 0x00, 0x00, 0x00]))
await self._hue_light_cluster.multicolor(
data=bytearray([0x20, 0x00, 0x00, 0x00])
)
self._effect = EFFECT_OFF
else:
# Don't react on unknown effects, for example 'colorloop'
Expand Down
1 change: 1 addition & 0 deletions zha/zigbee/cluster_handlers/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
CLUSTER_HANDLER_ZONE: Final[str] = "ias_zone"
ZONE: Final[str] = CLUSTER_HANDLER_ZONE
CLUSTER_HANDLER_INOVELLI = "inovelli_vzm31sn_cluster"
CLUSTER_HANDLER_PHILIPS_HUE_LIGHT: Final[str] = "philips_hue_light_cluster"

AQARA_OPPLE_CLUSTER: Final[int] = 0xFCC0
IKEA_AIR_PURIFIER_CLUSTER: Final[int] = 0xFC7D
Expand Down

0 comments on commit e5b8630

Please sign in to comment.