Skip to content

Commit a62f188

Browse files
authored
Do not restore light group external state attributes (#70)
1 parent 130d75c commit a62f188

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/test_light.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,21 @@ async def test_zha_group_light_entity(
798798
# test that the lights were created and are off
799799
assert bool(entity.state["on"]) is False
800800

801+
# Group entities do not support state restoration
802+
entity.restore_external_state_attributes(
803+
state=True,
804+
off_with_transition=False,
805+
off_brightness=12,
806+
brightness=34,
807+
color_temp=500,
808+
xy_color=(1, 2),
809+
hs_color=(3, 4),
810+
color_mode=ColorMode.XY,
811+
effect="colorloop",
812+
)
813+
814+
assert bool(entity.state["on"]) is False
815+
801816
# test turning the lights on and off from the client
802817
await async_test_on_off_from_client(zha_gateway, group_cluster_on_off, entity)
803818
await _async_shift_time(zha_gateway)

zha/application/platforms/light/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,3 +1394,19 @@ def _make_members_assume_group_state(
13941394

13951395
for platform_entity in self.group.get_platform_entities(Light.PLATFORM):
13961396
platform_entity._assume_group_state(update_params)
1397+
1398+
def restore_external_state_attributes(
1399+
self,
1400+
*,
1401+
state: bool | None,
1402+
off_with_transition: bool | None,
1403+
off_brightness: int | None,
1404+
brightness: int | None,
1405+
color_temp: int | None,
1406+
xy_color: tuple[float, float] | None,
1407+
hs_color: tuple[float, float] | None,
1408+
color_mode: ColorMode | None,
1409+
effect: str | None,
1410+
) -> None:
1411+
"""Restore extra state attributes."""
1412+
# Groups do not restore external state attributes

0 commit comments

Comments
 (0)