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

Setting a time helper during an automation triggered by this entity leads to an additional execution at a wrong time #117746

Closed
swoga opened this issue May 19, 2024 · 0 comments · Fixed by #117879

Comments

@swoga
Copy link
Contributor

swoga commented May 19, 2024

The problem

I have a time-only helper: input_datetime.test and an automation that is triggered by it and in the automation, the helper is reset to a predefined value:

alias: test
description: ""
trigger:
  - platform: time
    at: input_datetime.test
    enabled: true
condition: []
action:
  - service: input_datetime.set_datetime
    metadata: {}
    data:
      time: "00:00:00"
    target:
      entity_id: input_datetime.test
mode: single

Setting the helper during the automation probably leads to some issue and causes the automation to be executed again at the previously set time (on the next day) and 00:00:00.

I have also noticed (by using profiler.log_event_loop_scheduled) that there are often two scheduled jobs for one point in time of the automation trigger in the event loop (usually immediately after restarting Home Assistant or change of the automation).
When the helper is changed, all jobs are normally also updated, but if this happens during automation, an old job remains.

If a delay is used before the service call, the jobs are also updated correctly and the problem does not occur.

(The real purpose of this automation is to dynamically pre-program switch-on times for devices, which is reset after execution, and by means of a condition the value 00:00:00 is ignored, which is used as a dummy value if no switch-on is desired.)

What version of Home Assistant Core has the issue?

core-2024.5.3 & core-2024.6.0.dev0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

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

Diagnostics information

home-assistant.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant