06-17-2023 12:08 AM - edited 06-17-2023 12:46 PM
I am trying to write a script in the Google Home Script Editor that uses multiple automations inside the `automations` struct as described at the bottom of the article "Automation".
Here is a simple example that is modified from the example in the documentation article:
metadata:
name: Test MultiAuto
description: Testing multiple automations in a single script.
automations:
- name: At 11:40pm, turn on light.
starters:
- type: assistant.event.OkGoogle
eventData: query
is: help me eat
actions:
type: device.command.OnOff
devices: Sofa - Living Room
on: true
- name: At 11:38pm, turn off light and broadcast "time to sleep"
starters:
type: time.schedule
at: 2:40 AM # HH:MM XM (12 hours format). Adjust time as needed
actions:
- type: device.command.OnOff
devices: Sofa - Living Room
on: false
- type: assistant.command.Broadcast
message: time to sleep
devices: Living Room Display - Living Room
When I say "Hey Google, help me eat" it doesn't always work. For the first 20 minutes of trying to write and debug the script it wasn't working. It finally started just working oddly for a while. But then I changed the `is:` to a new query such as "help me test" and it was back to saying it doesn't understand. However, saying the previous query "help me eat" made it give no response like it was working, but the actions didn't actually execute. After another 10 minutes of it not responding to the new "help me test" query, I changed the script back to "help me eat" and saved it, and then instantly the assistant picked up "help me eat" again and executed the respective action.
The only thing I can think of right now is that the `assistant.event.OkGoogle` starter query takes time to fully propagate in the system and recognize the query?
I have a more complex script with 4 automations each with their own `assistant.event.OkGoogle` starter, and none of those sets of starters ever register and execute their respective actions. I'd love for this to work.
I am using a Nest Hub Max for testing the script. That's what I am saying "Hey Google, help me eat" to. Hopefully this helps, thank you!
06-17-2023 09:10 AM
Thanks for sharing your experience @Alphabet. assistant.event.OkGoogle propagation should not take time. To isolate the problem, can you try a very simple script like one below and use bunch of unique queries (e.g. "test automation 1", "test automation 2" etc.) to run the automation? Please share if propagation is taking time when you update the query.
metadata:
name: Test automation
description: Test automation
automations:
starters:
- type: assistant.event.OkGoogle
eventData: query
is: Test automation 1 # Then replace with Test automation 2 etc.
actions:
- type: assistant.command.OkGoogle
okGoogle: Tell me the weather
devices: <your speaker name from autocomplete>
06-17-2023 12:44 PM - edited 06-17-2023 12:46 PM
Hey @Prafulla,
thanks for the quick response! I don't have any issues with using the assistant.event.OkGoogle in scripts with single automations.
Here is a custom script that has been working fine for the past 2-3 days. I can say "Hey Google, fix upstairs bathroom" or "Hey Google, Fix the upstairs bathroom" and it executes properly every time.
# --------------------------------------------------------------------------------------------- #
# On the Nanoleaf Matter A19 bulbs, if the power is accidentially cut for less than ~3 seconds,
# their state is sometimes misrepresented. This automation refreshes them immediately if needed.
# --------------------------------------------------------------------------------------------- #
metadata:
name: Fix Upstairs Bathroom
description: Fixes the upstairs bathroom lights states in the event of accidentally cutting the power (light switch).
automations:
starters:
- type: assistant.event.OkGoogle
eventData: query
is: Fix Upstairs Bathroom
- type: assistant.event.OkGoogle
eventData: query
is: Fix the Upstairs Bathroom
actions:
- type: device.command.OnOff
on: true
devices:
- Right Light - Upstairs Bathroom
- Left Light - Upstairs Bathroom
- type: time.delay
for: 1sec
- type: device.command.OnOff
on: false
devices:
- Right Light - Upstairs Bathroom
- Left Light - Upstairs Bathroom
Just to be sure, I modified my script from my original post to match your script:
metadata:
name: Test MultiAuto
description: Testing multiple automations in a single script.
automations:
starters:
- type: assistant.event.OkGoogle
eventData: query
is: Test automation two # Then replace with Test automation 2 etc.
actions:
- type: assistant.command.OkGoogle
okGoogle: Tell me the weather in london
devices: Living Room - Living Room
This worked instantly, though I had to change the integer "1"/"2" to "one"/"two" as assistant doesn't seem to normally parse the voice as an integer. When changing the "is" field to "one" or "two" or "three" any change instantly propagated. No issues.
I then took the liberty to modify it even further to use multiple automations in the single script:
metadata:
name: Test MultiAuto
description: Testing multiple automations in a single script.
automations:
- name: Testing Automation 1
starters:
- type: assistant.event.OkGoogle
eventData: query
is: Test automation one # Then replace with Test automation 2 etc.
actions:
- type: assistant.command.OkGoogle
okGoogle: Tell me the weather in berlin
devices: Living Room - Living Room
- name: Testing Automation 2
starters:
- type: assistant.event.OkGoogle
eventData: query
is: Test automation two # Then replace with Test automation 2 etc.
actions:
- type: assistant.command.OkGoogle
okGoogle: Tell me the weather in london
devices: Living Room - Living Room
This didn't work. I don't think something is wrong with how I'm using multiple automations (syntax), but please let me know?
I found that the assistant sometimes caches the single automation script. So Testing Automation 2 works, but Testing Automation 1 didn't. Eventually they both stopped working.
06-17-2023 06:08 PM
Very interesting. Thanks for sharing your observations @Alphabet. I am taking a note of this for internal investigations.
08-18-2023 01:07 AM
Any update on this topic by any chance ?
09-12-2023 02:07 AM
i guess not
10-09-2023 01:01 AM
Hello ?
Its been 2 months now , do you have an update ?
06-18-2023 12:53 AM - edited 06-18-2023 01:09 AM
Hi
I have the exact same problem. My code follows (will be extended to all days of the week):
metadata:
name: Garbage Assistant
description: Scripted automation
automations:
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: Test garbage Monday
actions:
- type: assistant.command.Broadcast
message: On Monday you should take out the white organic bag.
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: Test Garbage Tuesday
actions:
- type: assistant.command.Broadcast
message: On Tuesday you should take out the black mixed waste bag.
07-12-2023 07:46 PM - edited 07-20-2023 11:12 PM
Just wanted to add that I'm having the exact same issue with the 'OKGoogle' starter when there are multiple automations in one script.
@Prafulla, any updates on this issue?
Here's an example script that's not working for me. However, when I remove either one of the automations from this script, then the remaining one works on it's own.
metadata:
name: Turn on/off the great room lights
description: When someone tells Assistant "Turn on/off the great room lights", turn on or off all the lights in the great room
automations:
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: Turn on the great room lights
actions:
type: device.command.OnOff
on: true
devices:
- Dinning Room
- Kitchen
- Living Room
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: Turn off the great room lights
actions:
type: device.command.OnOff
on: false
devices:
- Dinning Room
- Kitchen
- Living Room
07-25-2023 09:43 PM
Same issue here with exact same formatting
07-22-2023 11:46 PM
I'm having the same issues. I have a complex routine that won't work anymore because it has 46 actions. I've been trying to turn it into script, because I rely heavily on it. My "ok google" and any broadcast command will not work. It seems to just skip over those actions completely. The lights I have scheduled mostly work, but the other commands will not fire.
07-26-2023 11:45 AM - edited 07-26-2023 11:46 AM
Here's an example of a multi-"OkGoogle" automation that doesn't seem to respond to each trigger. It's supposed to house all of my possible control functions for the blinds in my living room. Scenes are setup in Switchbot, and those scenes are visible and executable from Google Home. Before Script Editor (SE), I had separate automations for each of these, but I thought with SE I could bundle them up into one. Am I misunderstanding the functionality of SE and it's capabilities?
metadata:
name: Blinds Control
description: All controls for the blinds
automations:
# Close them
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: close the blinds
actions:
- type: device.command.ActivateScene
activate: true
devices: Night Blinds
# Open them
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: open the blinds
actions:
- type: device.command.ActivateScene
activate: true
devices: Open Blinds
# Dim them
# Close them halfway
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: dim the blinds
actions:
- type: device.command.ActivateScene
activate: true
devices: Dim Blinds
07-29-2023 12:42 AM
It looks like it is not only this command : assistant.command.OkGoogle
I experience the same issue with all the commands using the assistant :
assistant.command.Broadcast
assistant.command.OkGoogle
assistant.event.OkGoogle
08-02-2023 02:05 AM
I just wanted to add that when I try to use assistant.command.OkGoogle as a starter to kick off a basic automation (I simply want to say "I am in bed" have it read back basic information conditional on stuff like the time, just to get familiar with building the script where I will build on this later) and the script editor will not recognize the command and won't validate.
In the end, I need to prompt Google Home to start the automation, and want to do so via voice, and not have to use my device to start it. But I'm lost as to how to get the automation to start.
08-10-2023 12:42 PM
So weird! Maybe try this as the starter type:
assistant.event.OkGoogle
Using "event" instead of "command" may help? I also know that Script Editor is very picky about indents
09-05-2023 11:19 AM
09-05-2023 11:57 AM
I haven't tested recently. But unfortunately I don't believe so. This is probably a large internal undertaking and this is preview. They did just release a significant update to the scripting preview, but this issue doesn't seem to be included as a fix. Maybe we will see an update around October 4th. 🤞
09-17-2023 03:48 PM
Same problem here too. I created the simplest of automations, no other starters and very simple commands, and confirmed that only the first instance of the okGoogle starter will work.
09-18-2023 11:54 AM
I have the same problem :
- assistant.event.OkGoogle
- assistant.command.OkGoogle
- assistant.command.Broadcast
... don't work il you have a multiple conditions script needing "-name: ... ".
All other command or event work fine in that case.
We have to wait october the 4th ??
09-18-2023 12:43 PM
Same problem here as well. I wanted to use a single google assistant phrase to trigger different sets of lights based on time of day but this issue prevents me from achieving that 😕
12-23-2023 02:12 PM
All - I've had the same problems with multiple starters in the same automation. My only solution was to break them up into two different automations. Not ideal, but after I did that they worked flawlessly.
01-04-2024 06:26 AM
looks like it is fixed now, some script i made long ago started broadcasting properly ! 😎
01-04-2024 07:28 AM
Yes seems like it. Just tried my broken routines and they're working! Hooray! 👏👏
01-04-2024 09:00 AM
Same here! Finally!! 🎉
02-09-2024 12:50 PM
Not here... (I'm in France)
Even worse : it looks like "okgoogle" starter can't work with a "broadcast" action.
This script raise up the volume, but my hub never says "lunch is ready".
But if I start the routine manually in Google Home, it works :
metadata:
name: test
description: Scripted automation
automations:
starters:
- type: assistant.event.OkGoogle
eventData: query
is: test lumière
actions:
- type: device.command.SetVolume
volumeLevel: 80
devices: Cuisine - Cuisine
- type: time.delay
for: 2sec
- type: assistant.command.Broadcast
message: "lunch is ready"
devices: Cuisine - Cuisine
03-06-2025 12:22 PM
Problems with multiple starters in the same automation are here again
03-08-2025 12:21 AM - edited 03-09-2025 02:50 PM
This is so annoying. An update from a couple of days ago indeed seems to have broken this again and introduced some other bugs (every command related to blinds/curtains now always closes all blinds/curtains, even when instructing just a single one to open).
EDIT: My issue with the blinds is also caused by this, it just executes the actions of the very first automation block which includes an OkGoogle starter (which happens to be closing all blinds in my case), even if it is supposed to match one further down the script.
03-08-2025 02:22 AM - edited 03-08-2025 02:23 AM
It happened to me, too. I have multiple automations, but it always run the first automation even if the 3rd is supposed to run.
I also found that the "assistant.command.Broadcast" doesn't work unless the Device is specified. Previously The Device was optional.
03-08-2025 04:02 PM
I’m experiencing the same issue.
I have multiple automations in a single file, and all of them were working perfectly fine until about 2-3 days ago.
The timed automations are still functioning, but anything involving voice commands is no longer working.
I’ve deleted all existing scripts and created new ones, but the problem persists.
To troubleshoot, I deleted all scripts and created a simple one to turn on a light bulb when I say “Turn on bulb,” and a separate one to turn it off when I say “Turn off bulb.” This setup works fine on its own.
However, when I combine these two scripts/commands into one script (see below), the bulb turns on, but it does not turn off as expected with the respective command.
I swapped the order of the automations, and it turns out that Google only executes the first automation in the script, ignoring all subsequent ones.
This is rather very annoying considering the time and energy spent into creating these automations.
metadata:
name: Bulb control
description: Bulb control
automations:
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: turn on bulb
actions:
- type: device.command.OnOff
devices:
- Bulb - Kitchen
on: true
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: turn off bulb
actions:
- type: device.command.OnOff
devices:
- Bulb - Kitchen
on: false
Considering the last time this happened, it took 6 months to resolve this, I'm wondering if it is even worth pursing Goolge home anymore.
It seems like Alexa gets better over time and Google gets worse. Alexa has AI features rolling out, whisper mode, drop-in feature etc.
With Google, even the broadcast feature now is a hit-and-miss - sometimes it'll broadcast my voice, sometimes the Google assistant reads out what I say using text-to-voice (most of the time it's usually off).
Feel like investing in Google home was a BIG mistake.
03-09-2025 09:02 AM
That's true, it's also started happening to me for about 2 to 3 days.
I have multiple starters in the same script, each one with its own actions, but now for some reason any voice command attached to any starter only executes the actions tied to the first starter in the script.
Hope they fix it soon
EXAMPLE:
metadata:
name: Tasker Playground
description: Tasker Google Home Playground
automations:
- name: CONTROLAR COMPUTADOR
starters:
- type: assistant.event.OkGoogle
eventData: query
is: "Desligar computador"
actions:
- type: home.command.Notification
title: "Google Home Tasker Routine"
body: "KWGT PC"
members: -
- name: CONTROLAR ABAJUR
starters:
- type: assistant.event.OkGoogle
eventData: query
is: "Ligar abajur"
actions:
- type: home.command.Notification
title: "Google Home Tasker Routine"
body: "KWGT Luz abajur"
members: -
In this code, if I say "Ok Google, ligar abajur" it will send my phone a notification saying "KWGT PC" instead of "KWGT Luz abajur"
03-10-2025 02:12 PM
Same problem here. Strangely it was working for one or two days again but now only the first action triggers permanently 🤢
Please fix soon as 👍🏼
03-13-2025 02:51 PM
How do I subscribe to this thread? Is everything related to Google Home/Nest this busted?
Give me my assistant.event.OkGoogle automations back. I have 48 of those starters in one script and then 70 more in another script. Splitting them into multiple scripts will be tedious and not worth my time.
Looking into Rhasppy. Google dissappoints me.
03-13-2025 03:56 PM
The only thing we can do is .... wait until Google wake up.
03-14-2025 02:22 PM
You can subscribe by clicking on "Options" on the top right of this page.
I have split my scripts by copy & pasting but it were only 13.
a month ago
Still same issue. Always first action gets executed, if any of the starters match.
Sunday
Something is changed today. Previously the first automation was run when the 2nd one was triggered. Now even the first automation is not run at all. The 2nd automation is completely ignored.