Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
J. Nick Koston
63d0e2a582
Disable eager start for automations
fixes #117781

If a state change event triggers and automation which flips the state back
and the websocket listener runs after the automation, the state changes
would get delivered out of order
2024-07-27 17:26:31 -05:00

View file

@ -769,7 +769,7 @@ class _ScriptRun:
context=self._context, context=self._context,
return_response=return_response, return_response=return_response,
), ),
eager_start=True, eager_start=False,
) )
) )
if response_variable: if response_variable:
@ -786,12 +786,17 @@ class _ScriptRun:
"""Activate the scene specified in the action.""" """Activate the scene specified in the action."""
self._step_log("activate scene") self._step_log("activate scene")
trace_set_result(scene=self._action[CONF_SCENE]) trace_set_result(scene=self._action[CONF_SCENE])
await self._hass.services.async_call( await self._async_run_long_action(
scene.DOMAIN, self._hass.async_create_task_internal(
SERVICE_TURN_ON, self._hass.services.async_call(
{ATTR_ENTITY_ID: self._action[CONF_SCENE]}, scene.DOMAIN,
blocking=True, SERVICE_TURN_ON,
context=self._context, {ATTR_ENTITY_ID: self._action[CONF_SCENE]},
blocking=True,
context=self._context,
),
eager_start=False,
)
) )
async def _async_event_step(self) -> None: async def _async_event_step(self) -> None: