Automation retriggering does not run actions

I try to achieve the following radio-controlled based presence scenario:

  • when radio signal is received, I trigger an automation to:
    – set an input_text to the time-stamp until this presence signal should expire (e.g. now() + 4 mins)
    – set an input_boolean to on
    – wait 5 mins
    – check if the input_text value is less than now()
    – if so, set the input_boolean to off.

In an ideal case, if item is present it should send a radio signal every 3min or so.
My problem is that in case of presence, I can see in the logs that the second automation was triggered, but the actions part is not invoked (thus the input_text value is not updated).
Seems like it waits until the first invocation of the automation finishes. The documentation also says something like that.

I changed the automation to invoke a script instead (starting from the wait actions) in the hope that the script part is run somehow in the “background”, thus the automation is considered finished. But unfortunately it still waits.
If I define another automation to trigger on the same condition to stop the script there will be a race condition between the automations, which is not relaible, thus not a good solution.

Any idea on how should such a scenario be implemented?

Thanks in advance!

which version of HA are you on?
There was a change in the way automations run if called multiple times, see running modes part of the 0.113 update notes.

First of all, I would use an “input_datetime” instead of a “input_text”.
Secondly, I would split this up into two automations.
One that sets the datetime, and one that trigger when now > input_datetime.

  trigger:
    - platform: template
      value_template: {{ as_timestamp(states('input_datetime.my_check')) < states.sensor.time.last_changed.timestamp() }}

(Just validate in the template section of the developer tools that you dont have any timezone-issues)

I use the latest version: 0.113.3.

I was aware of the new running modes for scripts, but I missed the automations.
Adding restart mode to the automation, worked as expected. Thanks!

1 Like

Short and clean solution. Thanks for the hint.