cancel
Showing results for 
Search instead for 
Did you mean: 

Google Home Scripts - can you loop? Can you recurse? Can you stop a running script programmatically?

BinaryRhyme
Community Member

I'm just dipping my toe into home scripting (but I'm a software architect with decades behind me). I'd like to set up loops that either run infinitely (or a really long time) but can be stopped by command. I haven't seen anything in the documentation on what happens should you attempt recursion (issue a command to start the currently running script.)

Similarly, if I just brute forced a script with lots of commands and time delays, but then wanted to terminate execution of the script, I haven't found any formal stop methods. 

Any thoughts or hidden gems of arcane knowledge?

2 Recommended AnswerS

sipriyadarshi
Solutions Expert
Solutions Expert

Hello @BinaryRhyme ,

Thanks for reaching out with your issue. To answer you question, the default mode is ON for the execution or implementation of devices . As of now you can change the state of the device by leveraging the capabilities of the condition construct.

View Recommended Answer in original post

This is a response I got from support:

 

Google Assistant does not support the concept of loops, so you cannot create a script that will continue to run indefinitely.

Another workaround is to use a third-party automation tool, such as IFTTT or Zapier. These tools allow you to create scripts that can loop indefinitely. For example, you could create an IFTTT applet that turns on a light every minute. This will continue indefinitely until you delete the applet.

While these workarounds are not as convenient as being able to loop a script directly in Google Assistant, they are the only way to achieve this effect at the present time.

View Recommended Answer in original post

4 REPLIES 4

sipriyadarshi
Solutions Expert
Solutions Expert

Hello @BinaryRhyme ,

Thanks for reaching out with your issue. To answer you question, the default mode is ON for the execution or implementation of devices . As of now you can change the state of the device by leveraging the capabilities of the condition construct.

That reply makes no sense at all. 

This is a response I got from support:

 

Google Assistant does not support the concept of loops, so you cannot create a script that will continue to run indefinitely.

Another workaround is to use a third-party automation tool, such as IFTTT or Zapier. These tools allow you to create scripts that can loop indefinitely. For example, you could create an IFTTT applet that turns on a light every minute. This will continue indefinitely until you delete the applet.

While these workarounds are not as convenient as being able to loop a script directly in Google Assistant, they are the only way to achieve this effect at the present time.

Thanks for your reply - I've been looking into alternatives for automation scripting... (Home Assistant, IFTTT specifically - I'll check out Zapier).