How do I match the exact wording of the phrase that I use with Google Assistant to the switch? For example, if I want a switch to change the input on my receiver to “CD”, how would I define the appropriate trigger phrase and ensure that it matches the relevant command in the Broadlink switch definition?
Can I use the Automation editor in the HA web interface to configure these triggers/actions? (I don’t see a trigger type which seems appropriate for Google Assistant)
How can I script a series of actions to be triggered by a single Google Assistant command?
You just call the name of the switch you’ve defined. If your switch is called “CD”, you just say “Hey google, turn on CD”.
I don’t think you can write automations that do this.
You can write a script that performs multiple actions, then expose that script to GA, then say “Hey google, activate [or start] [script name]. It sounds like most of what you want to do is achievable via scripts.
Ah OK, so my GA commands must say either “Turn On x” or “Activate/Start x”. Is that the full extent of GA’s lexicon for HA, or is there a guide somewhere which provides a full list of available phrases?
I’m trying to work out how to expose my Broadlink to Google Assistant, but can’t work out where the syntax from the above example fits. I currently have this at the end of my config file:
switch:
So I tried the syntax below, called the request_sync service (which didn’t give any feedback, positive or negative or positive, when I called it), then tried “Hey Google, turn on Samsung TV”. Google wasn’t able to help. Any advice re. what’s wrong with my config? The agent_user_id that I used was a made-up text string - I’m not sure if it is supposed to correspond to some id in the Googleverse?
So I just realised that HA was failing to start, and had flagged a syntax error in my command_on definition. I based my syntax on the example here, but I guess I got something wrong???
OK I found out that the IR code and the “command_on:” need to be on the same line - I have managed to execute my first command from Google Home!
So the inevitable next question: much of what I want to do involves several actions, so I guess I need to define scripts in scipts.yaml. My question is: how do I define triggers for Google Assistant? Does anyone have an example of a script which is triggered by GA?
Just make sure the script is exposed to Google Assistant and then shows up in the list of home control items in the Home app. Then to run the script from GH say 'hey google, turn on . If saying ‘turn on’ is annoying you can add a shortcut inside the Home app.
Thanks for the tip, At the moment I am struggling with how to define the trigger for my script. Is it simply the case that saying “Hey Google turn on {script name]” will cause the script with that name to be executed, and that I don’t need to explicitly define a trigger in my script?
I think for scripts or scenes you have to use “start” or “activate” to invoke them (eg “Hey google, activate watch tv”, where “watch tv” is the name of the script in HA).
I’ve made my first attempt at getting Google Home to execute a script, but the syntax that I’m using to expose my script to GA is being flagged as invalid.
My scripts.yaml file is below. If I remove the “google_assistant: true” line it validates fine, but it’s invalid if I include that line.
Can anyone advise on what my syntax should be?
watch_humax:
alias: Watch Humax
google_assistant: true
sequence:
- alias: TV On
service: tv_samsung.turn_on
- delay:
# supports seconds, milliseconds, minutes, hours
seconds: 4
- alias: Receiver on
service: tv_samsung.turn_off
Thanks. I’ve stared and stared at that first entity_id definition and I can’t see where the extra space is! There was definitely only a single space after the colon after entity_id, so I guess the extra space was somewhere else? In any case, I copied and pasted your code and now it passes the validation checks - thanks.
So I can now see the script on the home page of my HA web interface, but when I click on the switch to turn it on the Broadlink doesn’t respond (I corrected the MAC address, which was incorrect in my last post). The switch moves to the right toggle position, a message pops up saying “Turned on Watch Humax”, then the switch moves back to the left position. Is the clickable toggle switch next to a script item on the home page intended to execute the script, or simply to enable it?
The Broadlink is definitely online, as it it continuing to respond to requests from IFTT via the RM Bridge app which I have running on an Android tablet. How can I check whether HA is connected to the Broadlink?