mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Improve WLED pure white support for RGBW (#30477)
This commit is contained in:
parent
51db9bdfce
commit
4e62da9c8e
@ -191,6 +191,11 @@ class WLEDLight(Light, WLEDDeviceEntity):
|
|||||||
hue, sat = self._color
|
hue, sat = self._color
|
||||||
data[ATTR_COLOR_PRIMARY] = color_util.color_hsv_to_RGB(hue, sat, 100)
|
data[ATTR_COLOR_PRIMARY] = color_util.color_hsv_to_RGB(hue, sat, 100)
|
||||||
|
|
||||||
|
# On a RGBW strip, when the color is pure white, disable the RGB LEDs in
|
||||||
|
# WLED by setting RGB to 0,0,0
|
||||||
|
if data[ATTR_COLOR_PRIMARY] == (255, 255, 255):
|
||||||
|
data[ATTR_COLOR_PRIMARY] = (0, 0, 0)
|
||||||
|
|
||||||
# Add requested or last known white value
|
# Add requested or last known white value
|
||||||
if ATTR_WHITE_VALUE in kwargs:
|
if ATTR_WHITE_VALUE in kwargs:
|
||||||
data[ATTR_COLOR_PRIMARY] += (kwargs[ATTR_WHITE_VALUE],)
|
data[ATTR_COLOR_PRIMARY] += (kwargs[ATTR_WHITE_VALUE],)
|
||||||
|
@ -193,3 +193,20 @@ async def test_rgbw_light(
|
|||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
assert state.attributes.get(ATTR_HS_COLOR) == (28.874, 72.522)
|
assert state.attributes.get(ATTR_HS_COLOR) == (28.874, 72.522)
|
||||||
assert state.attributes.get(ATTR_WHITE_VALUE) == 100
|
assert state.attributes.get(ATTR_WHITE_VALUE) == 100
|
||||||
|
|
||||||
|
await hass.services.async_call(
|
||||||
|
LIGHT_DOMAIN,
|
||||||
|
SERVICE_TURN_ON,
|
||||||
|
{
|
||||||
|
ATTR_ENTITY_ID: "light.wled_rgbw_light",
|
||||||
|
ATTR_RGB_COLOR: (255, 255, 255),
|
||||||
|
ATTR_WHITE_VALUE: 100,
|
||||||
|
},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
state = hass.states.get("light.wled_rgbw_light")
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
assert state.attributes.get(ATTR_HS_COLOR) == (0, 0)
|
||||||
|
assert state.attributes.get(ATTR_WHITE_VALUE) == 100
|
||||||
|
Loading…
x
Reference in New Issue
Block a user