Discard delayed group events after target changes

This commit is contained in:
Bas Nijholt 2026-09-06 09:27:00 -07:00
commit 5240c31846
2 changed files with 79 additions and 0 deletions

View file

@ -1672,6 +1672,10 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
if self._adapt_delay > 0:
await asyncio.sleep(self._adapt_delay)
# Runtime settings may retire this profile's target while the event waits.
if entity_id not in self.lights:
return
await self._update_attrs_and_maybe_adapt_lights(
context=self.create_context("light_event", parent=event.context),
lights=[entity_id],