I tried it, but if the number of runs were set to 1, that would mean 0 for the repeat and that translated to the script no being run at all.
I’ll give it a try with the code you provided.
Maybe I did something wrong.
Edit: ran it with input_number.antal = 1 and nothing happens.
The script is executed, but immediately terminated.
Edit 2: if input_number.antal is set to 2 (or I assume more) it works and runs as expected. Can I make the script skip the repeat step if input_number.antal is set to 1?
You’re welcome but you should know that marking your own post as the Solution is reserved for when you actually think of the solution yourself.
In this case, your automation was identified to be misusing template syntax and an example was provided demonstrating how to separate the last repetition from repeat.
It would mean no iterations withinrepeat and a single iteration after it. That equates to a count of 1.
EDIT
There’s something wrong with the automation you posted. It contains needlessly duplicated code.
When I run the script, it doesn’t do anything, when the input_number.antal is set to 1. Why is that then?
Do I have something inbeded somhow, that quites a script if there’s an error (ie the number of repeats being set to 0)?
Where’s the duplication?
I have a repeat and an action afterwards.
How can I reduce the code?
Edit: I see what you mean. I’ve copied it twice by mistake. Updated
Here’s another way that uses a Template Condition to determine if the extra actions should be executed. If it’s the last repetition, the extra actions are not executed.
Now I only need to find a way of entering the zone_ids: instead of creating a code per room.
I had a look here, but the solution doesn’t work for me, but I guess I should ask my question in that thread instead.