Hey guys, wondering if someone can clear something up for me. I have a script I’d like to run multiple times. I’ve called the script in an automation, but it only runs once, the first time and not the number of times it’s called. Is there something I’m overlooking or unaware of?
Here’s the automation:
- id: '1557894164073'
alias: Balcony Sunset
trigger:
- event: sunset
offset: +00:30:00
platform: sun
condition: []
action:
- data:
brightness: 80
entity_id: light.balcony
rgb_color:
- 208
- 213
- 210
transition: 200
service: light.turn_on
- data: {}
service: script.1557312839102
- delay: 00:00:05
- service: script.1557312839102
- delay: 00:00:05
- service: script.1557312839102
- delay: 00:00:05
- service: script.1557312839102
Ideally I’d like to run the script in a loop until a sensor triggers, but I’m not sure if that is possible.
Thanks for any pointers.
Bartem
May 15, 2019, 11:58pm
2
What is the actual script that you are calling doing? Can we see it ? I don’t think it will repeatedly let you call the same script that close together if it is still “running” from the first time. Check you log and you may see that it’s “already running” from the first execution.
1 Like
Thanks, that’s a thought.
Here’s the script I am calling. It should end, before it’s called again, right?
'1557312839102':
alias: Balcony LED Cycle
sequence:
- data:
event: balcony_white_strobe
service: ifttt.trigger
- delay: 00:00:05
- data:
event: balcony_strobe_flash
service: ifttt.trigger
- delay: 00:15:00
- data:
event: balcony_white_strobe
service: ifttt.trigger
- delay: 00:00:05
- data:
event: balcony_jumping_change
service: ifttt.trigger
- delay: 00:15:00
- data:
event: balcony_white_strobe
service: ifttt.trigger
- delay: 00:00:05
- data:
event: balcony_cross_fade
service: ifttt.trigger
- delay: 00:15:00
- data:
entity_id: light.balcony_led
service: light.turn_off
Here’s the Log entry from the Logbook, is that the log I should be reading?
Thanks for you help.
You are calling the script every 5 seconds and the script execution takes 45min 15 seconds. I cant see the point in that?
You should let the script finish before calling it again.
1 Like
Oh, OK. I thought the script would run to the end, THEN (after the 45min 15 seconds it takes to run), wait 5 seconds then run again.
So you’re saying the script is called, then wait 5 seconds, then called again. Therefore it only runs once.
Seems obvious now you point it out.
Is there a way to let the script run till the end first, or do I just add the time it takes to run? Should I use “wait” instead of delay?
So it should read like:
- id: '1557894164073'
alias: Balcony Sunset
trigger:
- event: sunset
offset: +00:30:00
platform: sun
condition: []
action:
- data:
brightness: 80
entity_id: light.balcony
rgb_color:
- 208
- 213
- 210
transition: 200
service: light.turn_on
- service: script.1557312839102
- delay: 00:45:20
- service: script.1557312839102
- delay: 00:45:20
- service: script.1557312839102
- delay: 00:45:20
- service: script.1557312839102