mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
Set last_service_data in the right place (#652)
* Set last_service_data in the right place * Do not get but access key * rename
This commit is contained in:
parent
d588a5984a
commit
aa9f69a7bb
1 changed files with 3 additions and 6 deletions
|
|
@ -1262,8 +1262,6 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
|
||||
context = context or self.create_context("adapt_lights")
|
||||
|
||||
self.manager.last_service_data[light] = service_data
|
||||
|
||||
return prepare_adaptation_data(
|
||||
self.hass,
|
||||
light,
|
||||
|
|
@ -1337,6 +1335,8 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
service_data,
|
||||
data.context.id,
|
||||
)
|
||||
light = service_data[ATTR_ENTITY_ID]
|
||||
self.manager.last_service_data[light] = service_data
|
||||
await self.hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
|
|
@ -2134,10 +2134,7 @@ class AdaptiveLightingManager:
|
|||
|
||||
def start_transition_timer(self, light: str) -> None:
|
||||
"""Mark a light as manually controlled."""
|
||||
last_service_data = self.last_service_data.get(light)
|
||||
if not last_service_data:
|
||||
_LOGGER.debug("This should not ever happen. Please report to the devs.")
|
||||
return
|
||||
last_service_data = self.last_service_data[light]
|
||||
last_transition = last_service_data.get(ATTR_TRANSITION)
|
||||
if not last_transition:
|
||||
_LOGGER.debug(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue