@@ -515,11 +515,25 @@ async def async_test_on_off_from_light(
515
515
# turn on at light
516
516
await send_attributes_report (zha_gateway , cluster , {1 : 0 , 0 : 1 , 2 : 3 })
517
517
await zha_gateway .async_block_till_done ()
518
+
519
+ # group member updates are debounced
520
+ if isinstance (entity , GroupEntity ):
521
+ assert bool (entity .state ["on" ]) is False
522
+ await asyncio .sleep (0.1 )
523
+ await zha_gateway .async_block_till_done ()
524
+
518
525
assert bool (entity .state ["on" ]) is True
519
526
520
527
# turn off at light
521
528
await send_attributes_report (zha_gateway , cluster , {1 : 1 , 0 : 0 , 2 : 3 })
522
529
await zha_gateway .async_block_till_done ()
530
+
531
+ # group member updates are debounced
532
+ if isinstance (entity , GroupEntity ):
533
+ assert bool (entity .state ["on" ]) is True
534
+ await asyncio .sleep (0.1 )
535
+ await zha_gateway .async_block_till_done ()
536
+
523
537
assert bool (entity .state ["on" ]) is False
524
538
525
539
@@ -534,6 +548,13 @@ async def async_test_on_from_light(
534
548
zha_gateway , cluster , {general .OnOff .AttributeDefs .on_off .id : 1 }
535
549
)
536
550
await zha_gateway .async_block_till_done ()
551
+
552
+ # group member updates are debounced
553
+ if isinstance (entity , GroupEntity ):
554
+ assert bool (entity .state ["on" ]) is False
555
+ await asyncio .sleep (0.1 )
556
+ await zha_gateway .async_block_till_done ()
557
+
537
558
assert bool (entity .state ["on" ]) is True
538
559
539
560
@@ -695,6 +716,10 @@ async def async_test_dimmer_from_light(
695
716
if level == 0 :
696
717
assert entity .state ["brightness" ] is None
697
718
else :
719
+ # group member updates are debounced
720
+ if isinstance (entity , GroupEntity ):
721
+ await asyncio .sleep (0.1 )
722
+ await zha_gateway .async_block_till_done ()
698
723
assert entity .state ["brightness" ] == level
699
724
700
725
@@ -873,6 +898,11 @@ async def test_zha_group_light_entity(
873
898
# test that group light is now off
874
899
assert device_1_light_entity .state ["on" ] is False
875
900
assert device_2_light_entity .state ["on" ] is False
901
+
902
+ # group member updates are debounced
903
+ assert bool (entity .state ["on" ]) is True
904
+ await asyncio .sleep (0.1 )
905
+ await zha_gateway .async_block_till_done ()
876
906
assert bool (entity .state ["on" ]) is False
877
907
878
908
await send_attributes_report (zha_gateway , dev1_cluster_on_off , {0 : 1 })
@@ -881,13 +911,21 @@ async def test_zha_group_light_entity(
881
911
# test that group light is now back on
882
912
assert device_1_light_entity .state ["on" ] is True
883
913
assert device_2_light_entity .state ["on" ] is False
914
+ # group member updates are debounced
915
+ assert bool (entity .state ["on" ]) is False
916
+ await asyncio .sleep (0.1 )
917
+ await zha_gateway .async_block_till_done ()
884
918
assert bool (entity .state ["on" ]) is True
885
919
886
920
# turn it off to test a new member add being tracked
887
921
await send_attributes_report (zha_gateway , dev1_cluster_on_off , {0 : 0 })
888
922
await zha_gateway .async_block_till_done ()
889
923
assert device_1_light_entity .state ["on" ] is False
890
924
assert device_2_light_entity .state ["on" ] is False
925
+ # group member updates are debounced
926
+ assert bool (entity .state ["on" ]) is True
927
+ await asyncio .sleep (0.1 )
928
+ await zha_gateway .async_block_till_done ()
891
929
assert bool (entity .state ["on" ]) is False
892
930
893
931
# add a new member and test that his state is also tracked
@@ -905,6 +943,10 @@ async def test_zha_group_light_entity(
905
943
assert device_1_light_entity .state ["on" ] is False
906
944
assert device_2_light_entity .state ["on" ] is False
907
945
assert device_3_light_entity .state ["on" ] is True
946
+ # group member updates are debounced
947
+ assert bool (entity .state ["on" ]) is False
948
+ await asyncio .sleep (0.1 )
949
+ await zha_gateway .async_block_till_done ()
908
950
assert bool (entity .state ["on" ]) is True
909
951
910
952
# make the group have only 1 member and now there should be no entity
@@ -941,6 +983,10 @@ async def test_zha_group_light_entity(
941
983
await send_attributes_report (zha_gateway , dev1_cluster_on_off , {0 : 0 })
942
984
await send_attributes_report (zha_gateway , dev3_cluster_on_off , {0 : 0 })
943
985
await zha_gateway .async_block_till_done ()
986
+ # group member updates are debounced
987
+ assert bool (entity .state ["on" ]) is True
988
+ await asyncio .sleep (0.1 )
989
+ await zha_gateway .async_block_till_done ()
944
990
assert bool (entity .state ["on" ]) is False
945
991
946
992
# this will test that _reprobe_group is used correctly
@@ -956,6 +1002,10 @@ async def test_zha_group_light_entity(
956
1002
assert entity is not None
957
1003
await send_attributes_report (zha_gateway , dev2_cluster_on_off , {0 : 1 })
958
1004
await zha_gateway .async_block_till_done ()
1005
+ # group member updates are debounced
1006
+ assert bool (entity .state ["on" ]) is False
1007
+ await asyncio .sleep (0.1 )
1008
+ await zha_gateway .async_block_till_done ()
959
1009
assert bool (entity .state ["on" ]) is True
960
1010
961
1011
await zha_group .async_remove_members (
0 commit comments