This commit is contained in:
Bas Nijholt 2023-07-31 18:48:18 -07:00
commit 8a16c9fb03

View file

@ -1269,11 +1269,6 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
adapt_color: bool | None = None,
prefer_rgb_color: bool | None = None,
) -> None:
# This should never happen if it's been proactively adapted.
# The context.parent_id is the context.id of the service call that was intercepted
# and context.id here is from the resulting "light_event" event.
assert not self.manager.is_proactively_adapting(context.parent_id)
if (lock := self.manager.turn_off_locks.get(light)) and lock.locked():
_LOGGER.debug("%s: '%s' is locked", self._name, light)
return
@ -2050,12 +2045,12 @@ class AdaptiveLightingManager:
continue
for eid in filtered_entity_ids:
# Must add a new context otherwise _adapt_light will bail out
context = switch.create_context("intercept")
self.clear_proactively_adapting(eid)
self.set_proactively_adapting(context.id, eid)
await switch._adapt_light(
light=eid,
# Must add a new context otherwise _adapt_light will bail out
context=context,
transition=transition,
)