Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for: in trigger won't survive restarts or reloading automations #56642

Closed
finity69x2 opened this issue Sep 25, 2021 · 1 comment
Closed

for: in trigger won't survive restarts or reloading automations #56642

finity69x2 opened this issue Sep 25, 2021 · 1 comment

Comments

@finity69x2
Copy link
Contributor

The problem

If using "for:" in any trigger that supports it when HA restarts or automations are reloaded after the state, numeric_state, etc changes to the desired state but is waiting for the "for:" time to be reached the automation trigger condition will never be satisfied.

If for example you use the following trigger:

- platform: state
  entity_id: lock.door
  to: 'unlocked'
  for:
    minutes: 30

once the lock changes state to 'unlocked' if HA is restarted or automations are reloaded before the "for:" time is reached the trigger never occurs and the automation actions won't run.

This causes the need for an extremely complicated work around based on setting an input_datetime and doing multiple additional triggers and conditions to ensure the actions are performed when desired.

the same effect occurs for all "time" based functions in HA - timers, wait_template, delay, etc. which leaves the users with no reliable timed functionalities and so requires the above complex work arounds for any critical timed automations/scripts.

What is version of Home Assistant Core has the issue?

core-2021.8.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

automation and script

Link to integration documentation on our website

https://www.home-assistant.io/docs/automation/trigger/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@frenck
Copy link
Member

frenck commented Sep 25, 2021

This is correct and expected behavior. During reloading/being offline, Home Assistant cannot know what happened in the environment outside of Home Assistant.

For your own given example:

- platform: state
  entity_id: lock.door
  to: 'unlocked'
  for:
    minutes: 30

During a restart... the door might have been locked/unlocked...
Therefore, Home Assistant will not make assumptions on this part.

@frenck frenck closed this as completed Sep 25, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants