File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,7 @@ async def async_set_effect(
428
428
if effect == EFFECT_RANDOM :
429
429
await self .async_set_random ()
430
430
return
431
+ brightness = min (100 , max (0 , brightness ))
431
432
if effect == EFFECT_MUSIC :
432
433
await self .async_set_music_mode (brightness = brightness )
433
434
return
Original file line number Diff line number Diff line change @@ -934,6 +934,15 @@ def _updated_callback(*args, **kwargs):
934
934
counter_byte = transport .mock_calls [0 ][1 ][0 ][7 ]
935
935
assert counter_byte == 0
936
936
937
+ transport .reset_mock ()
938
+ # Verify brightness clamped
939
+ await light .async_set_effect ("RBM 1" , 50 , brightness = 500 )
940
+ assert transport .mock_calls [0 ][0 ] == "write"
941
+ assert (
942
+ transport .mock_calls [0 ][1 ][0 ]
943
+ == b"\xb0 \xb1 \xb2 \xb3 \x00 \x01 \x01 \x01 \x00 \x05 B\x01 2d\xd9 \x80 "
944
+ )
945
+
937
946
938
947
@pytest .mark .asyncio
939
948
async def test_SK6812RGBW (mock_aio_protocol , caplog : pytest .LogCaptureFixture ):
You can’t perform that action at this time.
0 commit comments