mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
Check for external light mode (temperature vs rgb) switch (#1282)
This commit is contained in:
parent
3d3d246918
commit
afd7b935d7
1 changed files with 25 additions and 0 deletions
|
|
@ -766,6 +766,31 @@ def _attributes_have_changed(
|
|||
context.id,
|
||||
)
|
||||
return True
|
||||
|
||||
if adapt_color and (
|
||||
(
|
||||
old_attributes.get(ATTR_COLOR_TEMP_KELVIN)
|
||||
and not new_attributes.get(ATTR_COLOR_TEMP_KELVIN)
|
||||
)
|
||||
or (
|
||||
old_attributes.get(ATTR_RGB_COLOR)
|
||||
and not new_attributes.get(ATTR_RGB_COLOR)
|
||||
)
|
||||
):
|
||||
last_mode = (
|
||||
"color_temp" if old_attributes.get(ATTR_COLOR_TEMP_KELVIN) else "rgb"
|
||||
)
|
||||
current_mode = (
|
||||
"color_temp" if new_attributes.get(ATTR_COLOR_TEMP_KELVIN) else "rgb"
|
||||
)
|
||||
_LOGGER.debug(
|
||||
"Light mode of %s changed from %s to %s with context.id='%s'",
|
||||
light,
|
||||
last_mode,
|
||||
current_mode,
|
||||
context.id,
|
||||
)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue