mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-28 04:44:39 +02:00
Fix adapt_only_on_bare_turn_on and apply does not result in manual_control (#729)
* Fix adapt_only_on_bare_turn_on and apply does not result in manual_control Closes #723 * fix style
This commit is contained in:
parent
da5147a583
commit
435b2ce5d0
2 changed files with 22 additions and 2 deletions
|
|
@ -1376,9 +1376,10 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
timer = self.manager.transition_timers.get(light)
|
||||
if timer is not None and timer.is_running():
|
||||
_LOGGER.debug(
|
||||
"%s: Light '%s' is still transitioning",
|
||||
"%s: Light '%s' is still transitioning, context.id='%s'",
|
||||
self._name,
|
||||
light,
|
||||
context.id,
|
||||
)
|
||||
elif (
|
||||
# This is to prevent lights immediately turning on after
|
||||
|
|
@ -1390,9 +1391,10 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
and turn_off.time_fired > turn_on.time_fired
|
||||
):
|
||||
_LOGGER.debug(
|
||||
"%s: Light '%s' was turned just turned off",
|
||||
"%s: Light '%s' was turned just turned off, context.id='%s'",
|
||||
self._name,
|
||||
light,
|
||||
context.id,
|
||||
)
|
||||
else:
|
||||
filtered_lights.append(light)
|
||||
|
|
@ -1489,6 +1491,8 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
self._take_over_control
|
||||
and self._adapt_only_on_bare_turn_on
|
||||
and from_turn_on
|
||||
# adaptive_lighting.apply can turn on light, so check this is not our context
|
||||
and not is_our_context(event.context)
|
||||
):
|
||||
service_data = self.manager.turn_on_event[entity_id].data[ATTR_SERVICE_DATA]
|
||||
if self.manager._mark_manual_control_if_non_bare_turn_on(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue