File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
zha/application/platforms/light Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -823,7 +823,8 @@ async def test_zha_group_light_entity(
823
823
# test that the lights were created and are off
824
824
assert bool (entity .state ["on" ]) is False
825
825
826
- # Group entities do not support state restoration
826
+ # Group entities do not support state restoration,
827
+ # except for off_brightness and off_with_transition
827
828
entity .restore_external_state_attributes (
828
829
state = True ,
829
830
off_with_transition = False ,
@@ -837,6 +838,8 @@ async def test_zha_group_light_entity(
837
838
)
838
839
839
840
assert bool (entity .state ["on" ]) is False
841
+ assert bool (entity .state ["off_with_transition" ]) is False
842
+ assert entity .state ["off_brightness" ] == 12
840
843
841
844
# test turning the lights on and off from the client
842
845
await async_test_on_off_from_client (zha_gateway , group_cluster_on_off , entity )
Original file line number Diff line number Diff line change @@ -1401,4 +1401,9 @@ def restore_external_state_attributes(
1401
1401
effect : str | None ,
1402
1402
) -> None :
1403
1403
"""Restore extra state attributes."""
1404
- # Groups do not restore external state attributes
1404
+ # Group state is calculated from the members,
1405
+ # except for off_with_transition and off_brightness
1406
+ if off_with_transition is not None :
1407
+ self ._off_with_transition = off_with_transition
1408
+ if off_brightness is not None :
1409
+ self ._off_brightness = off_brightness
You can’t perform that action at this time.
0 commit comments