Add Palette to WLED Effect Service (#41724)
parent
c16f107f6b
commit
52c93edb53
|
@ -67,6 +67,7 @@ async def async_setup_entry(
|
|||
vol.Optional(ATTR_INTENSITY): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
),
|
||||
vol.Optional(ATTR_PALETTE): vol.Any(cv.positive_int, cv.string),
|
||||
vol.Optional(ATTR_REVERSE): cv.boolean,
|
||||
vol.Optional(ATTR_SPEED): vol.All(
|
||||
vol.Coerce(int), vol.Range(min=0, max=255)
|
||||
|
@ -350,6 +351,7 @@ class WLEDSegmentLight(LightEntity, WLEDDeviceEntity):
|
|||
self,
|
||||
effect: Optional[Union[int, str]] = None,
|
||||
intensity: Optional[int] = None,
|
||||
palette: Optional[Union[int, str]] = None,
|
||||
reverse: Optional[bool] = None,
|
||||
speed: Optional[int] = None,
|
||||
) -> None:
|
||||
|
@ -362,6 +364,9 @@ class WLEDSegmentLight(LightEntity, WLEDDeviceEntity):
|
|||
if intensity is not None:
|
||||
data[ATTR_INTENSITY] = intensity
|
||||
|
||||
if palette is not None:
|
||||
data[ATTR_PALETTE] = palette
|
||||
|
||||
if reverse is not None:
|
||||
data[ATTR_REVERSE] = reverse
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ effect:
|
|||
intensity:
|
||||
description: Intensity of the effect
|
||||
example: 100
|
||||
palette:
|
||||
description: Name or ID of the WLED light palette.
|
||||
example: "Tiamat"
|
||||
speed:
|
||||
description: Speed of the effect. Number between 0 (slow) and 255 (fast).
|
||||
example: 150
|
||||
|
|
|
@ -456,6 +456,7 @@ async def test_effect_service(
|
|||
ATTR_EFFECT: "Rainbow",
|
||||
ATTR_ENTITY_ID: "light.wled_rgb_light_segment_0",
|
||||
ATTR_INTENSITY: 200,
|
||||
ATTR_PALETTE: "Tiamat",
|
||||
ATTR_REVERSE: True,
|
||||
ATTR_SPEED: 100,
|
||||
},
|
||||
|
@ -465,6 +466,7 @@ async def test_effect_service(
|
|||
light_mock.assert_called_once_with(
|
||||
effect="Rainbow",
|
||||
intensity=200,
|
||||
palette="Tiamat",
|
||||
reverse=True,
|
||||
segment_id=0,
|
||||
speed=100,
|
||||
|
@ -510,6 +512,7 @@ async def test_effect_service(
|
|||
{
|
||||
ATTR_EFFECT: "Rainbow",
|
||||
ATTR_ENTITY_ID: "light.wled_rgb_light_segment_0",
|
||||
ATTR_PALETTE: "Tiamat",
|
||||
ATTR_REVERSE: True,
|
||||
ATTR_SPEED: 100,
|
||||
},
|
||||
|
@ -518,6 +521,7 @@ async def test_effect_service(
|
|||
await hass.async_block_till_done()
|
||||
light_mock.assert_called_once_with(
|
||||
effect="Rainbow",
|
||||
palette="Tiamat",
|
||||
reverse=True,
|
||||
segment_id=0,
|
||||
speed=100,
|
||||
|
|
Loading…
Reference in New Issue