Mark as manually controlled when using flash, effect, or RGBW(W) (#684)

* Mark as manually controlled when using flash or effect

* Add comment

* Add RGBW and RGBWW
This commit is contained in:
Bas Nijholt 2023-07-30 11:49:40 -07:00 committed by GitHub
commit 2b35ee1e5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -13,6 +13,8 @@ from homeassistant.components.light import (
ATTR_COLOR_TEMP_KELVIN,
ATTR_HS_COLOR,
ATTR_RGB_COLOR,
ATTR_RGBW_COLOR,
ATTR_RGBWW_COLOR,
ATTR_TRANSITION,
ATTR_XY_COLOR,
)
@ -27,8 +29,11 @@ COLOR_ATTRS = { # Should ATTR_PROFILE be in here?
ATTR_HS_COLOR,
ATTR_RGB_COLOR,
ATTR_XY_COLOR,
ATTR_RGBW_COLOR,
ATTR_RGBWW_COLOR,
}
BRIGHTNESS_ATTRS = {
ATTR_BRIGHTNESS,
ATTR_BRIGHTNESS_PCT,

View file

@ -21,6 +21,8 @@ import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP_KELVIN,
ATTR_EFFECT,
ATTR_FLASH,
ATTR_RGB_COLOR,
ATTR_SUPPORTED_COLOR_MODES,
ATTR_TRANSITION,
@ -1450,6 +1452,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
context.id,
)
else:
# Need to fire manual control event because of significant_change
_fire_manual_control_event(self, light, context)
else:
_LOGGER.debug(
@ -2371,8 +2374,11 @@ class AdaptiveLightingManager:
and not force
):
keys = turn_on_event.data[ATTR_SERVICE_DATA].keys()
if (adapt_color and COLOR_ATTRS.intersection(keys)) or (
adapt_brightness and BRIGHTNESS_ATTRS.intersection(keys)
if (
(adapt_color and COLOR_ATTRS.intersection(keys))
or (adapt_brightness and BRIGHTNESS_ATTRS.intersection(keys))
or (ATTR_FLASH in keys)
or (ATTR_EFFECT in keys)
):
# Light was already on and 'light.turn_on' was not called by
# the adaptive_lighting integration.