Skip to content
Snippets Groups Projects
Commit 6e22a0e4 authored by Jason Antman's avatar Jason Antman Committed by Anders Melchiorsen
Browse files

Fix ZWave RGBW lights not producing color without explicit white_value (#15412)

* Fix ZWave RGBW lights not producing color without explicit white_value (#13930)

* simplify conditional in previous commit (#13930)

* ZwaveColorLight - only zero _white if white_value not specified in call (#13930)
parent ce5b4cd5
No related branches found
No related tags found
No related merge requests found
......@@ -324,9 +324,11 @@ class ZwaveColorLight(ZwaveDimmer):
else:
self._ct = TEMP_COLD_HASS
rgbw = '#00000000ff'
elif ATTR_HS_COLOR in kwargs:
self._hs = kwargs[ATTR_HS_COLOR]
if ATTR_WHITE_VALUE not in kwargs:
# white LED must be off in order for color to work
self._white = 0
if ATTR_WHITE_VALUE in kwargs or ATTR_HS_COLOR in kwargs:
rgbw = '#'
......
......@@ -255,6 +255,32 @@ def test_set_white_value(mock_openzwave):
assert color.data == '#ffffffc800'
def test_disable_white_if_set_color(mock_openzwave):
"""
Test that _white is set to 0 if turn_on with ATTR_HS_COLOR.
See Issue #13930 - many RGBW ZWave bulbs will only activate the RGB LED to
produce color if _white is set to zero.
"""
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
value = MockValue(data=0, node=node)
color = MockValue(data='#0000000000', node=node)
# Supports RGB only
color_channels = MockValue(data=0x1c, node=node)
values = MockLightValues(primary=value, color=color,
color_channels=color_channels)
device = zwave.get_device(node=node, values=values, node_config={})
device._white = 234
assert color.data == '#0000000000'
assert device.white_value == 234
device.turn_on(**{ATTR_HS_COLOR: (30, 50)})
assert device.white_value == 0
assert color.data == '#ffbf7f0000'
def test_zw098_set_color_temp(mock_openzwave):
"""Test setting zwave light color."""
node = MockNode(manufacturer_id='0086', product_id='0062',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment