I have an automation that stopped functioning lately. The trace states “Stopped because only a single execution is allowed.” No changes were made to the automation. I assume the issue is with the wait_for_trigger which I found/hobbled together from other automations here on the forum. The idea of the wait_for_trigger is to have the shades reopen once the sun’s elevation is high enough to not blind my eyes while sitting here at my desk. Any advice to resolve this?
- id: '22028368334373038'
alias: entry blinds blinding sun so close the shade
trigger:
- platform: time
at: 08:30:00
- platform: time
at: 08:45:00
- platform: time
at: 09:00:00
- platform: time
at: 09:15:00
- platform: time
at: 09:30:00
- platform: time
at: 09:45:00
- platform: time
at: '10:00:00'
condition:
- condition: and
conditions:
- condition: numeric_state
entity_id: sun.sun
attribute: azimuth
above: '120'
below: '137'
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: '29'
above: '10'
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: numeric_state
entity_id: sensor.lightlevel_entryway
above: 60
action:
- service: scene.turn_on
target:
entity_id: scene.closedentry
- wait_for_trigger:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
above: '30'
continue_on_timeout: false
- service: scene.turn_on
target:
entity_id: scene.daytimeentry
Don’t you use the mode of the automation?
I mean, I did not read and understand your automation thoroughly, sorry, I’m giving a hint (that might be not appropriate, sorry again) Mode is described here, maybe you should select one or another?
If you need single, it is perfectly fine.
But then, if the automation is triggered again while the previous execution is still waiting on one of the actions, like the wait_for_trigger, you’ll get the exception you described “Stopped because only a single execution is allowed.”
I’m always confused by the continue_on_timeout set to false because it is meant to abort the script but on the other hand, if true what does that mean? Execute the remaining actions?
I believe also that reaching 30 as elevation could take more or less time depending on the season and where you live. Might be the reason why the automation is triggered while the previous occurrence is still running?
The question is “Is it possible that waiting for the elevation to get to 30 is taking more than the 15 minutes before your next time platform trigger?”
The solution of Taras is the best as it is replacing multiple events by one.
But template triggers is not always easy for beginners, don’t know your level in coding (btw, if you are wondering, this is Jinja2 language) and you can always test your code in
I have same situation, but i cannot see why this stops. I have carshelter lights on/off based on sun, and then i made this another automation to check motion and brighten carshelter lights for 2 minutes.
You really should have created a new thread instead of replying to a 2 year old thread, but anyway.
You’re getting the error because you’re triggering on every state change of your motion detector, but your automation has a delay of 2 minutes.
Chances are, your motion detector is going back to not detecting motion before those 2 minutes are over.
This causes the automation to retrigger while it’s running
Also you are using the and condition the wrong way. All things you want to and need to be inside it. But you do not need it here anyway. Multiple conditions are and by default.
Yeah, there is only one condition, another one is not enabled. I was just testing around so i left it disabled there.
What i understood, conditions are not AND by default, but OR, if one condition is fullfilled, it will continue. Here i have selected AND condition from the pull down(not the default one). I know, its not needed here because there is only one condition, but i was testing out.
Now, how can i get this working then, i presume i need some sort of counter that reset everytime movement is detected and keeps the light litted ?
Under the conditions block, there’s a list of conditions. If one succeeds, it will proceed… to test the next condition. If it fails, the whole automation stops and nothing below is evaluated.
So you only need an and condition if you are inside an or condition.
And the other thing I meant, an and or an or condition applies to all the conditions in it. An and or or is not placed between conditions, but above them, with all the conditions that are anded or orred below, indented more. So in pseudocode: A and (B or C and D) is written as:
conditions:
- condition: A
- condition: or
conditions:
- condition: B
- condition: and
conditions:
- condition: C
- condition: D