mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-16 16:54:04 +02:00
Fix RGB Color Temp Swaps (#514)
* cherry pick from 486 * Refactor `_add_missing_attributes` --------- Co-authored-by: Bas Nijholt <bas@nijho.lt>
This commit is contained in:
parent
f5abf034c4
commit
03a2d9cbf6
2 changed files with 64 additions and 19 deletions
|
|
@ -47,6 +47,7 @@ from homeassistant.components.light import (
|
|||
ATTR_BRIGHTNESS_PCT,
|
||||
ATTR_COLOR_TEMP_KELVIN,
|
||||
ATTR_RGB_COLOR,
|
||||
ATTR_XY_COLOR,
|
||||
)
|
||||
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
||||
from homeassistant.components.light import SERVICE_TURN_OFF
|
||||
|
|
@ -873,10 +874,28 @@ def test_attributes_have_changed():
|
|||
assert _attributes_have_changed(
|
||||
old_attributes=attributes_1, new_attributes=attrs, **kwargs
|
||||
)
|
||||
# Switch from rgb_color to color_temp
|
||||
assert _attributes_have_changed(
|
||||
old_attributes={ATTR_BRIGHTNESS: 1, ATTR_COLOR_TEMP_KELVIN: 100},
|
||||
new_attributes={ATTR_BRIGHTNESS: 1, ATTR_RGB_COLOR: (0, 0, 0)},
|
||||
_LOGGER.debug("Test switch from color_temp to rgb_color")
|
||||
assert not _attributes_have_changed(
|
||||
old_attributes={ATTR_BRIGHTNESS: 1, ATTR_COLOR_TEMP_KELVIN: 2702},
|
||||
new_attributes={ATTR_BRIGHTNESS: 1, ATTR_RGB_COLOR: (255, 166, 87)},
|
||||
**kwargs,
|
||||
)
|
||||
_LOGGER.debug("Test switch from rgb_color to color_temp")
|
||||
assert not _attributes_have_changed(
|
||||
old_attributes={ATTR_BRIGHTNESS: 1, ATTR_RGB_COLOR: (255, 166, 87)},
|
||||
new_attributes={ATTR_BRIGHTNESS: 1, ATTR_COLOR_TEMP_KELVIN: 2702},
|
||||
**kwargs,
|
||||
)
|
||||
_LOGGER.debug("Test switch from color_temp to color_xy")
|
||||
assert not _attributes_have_changed(
|
||||
old_attributes={ATTR_BRIGHTNESS: 1, ATTR_COLOR_TEMP_KELVIN: 2702},
|
||||
new_attributes={ATTR_BRIGHTNESS: 1, ATTR_XY_COLOR: (0.526, 0.387)},
|
||||
**kwargs,
|
||||
)
|
||||
_LOGGER.debug("Test switch from color_xy to color_temp")
|
||||
assert not _attributes_have_changed(
|
||||
old_attributes={ATTR_BRIGHTNESS: 1, ATTR_XY_COLOR: (0.526, 0.387)},
|
||||
new_attributes={ATTR_BRIGHTNESS: 1, ATTR_COLOR_TEMP_KELVIN: 2702},
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue