Create automatons with a Google Home command as a trigger

I have Google assistant set-up in HA and it is working very well. I can give Google Home commands like “close garage door” and it works as expected. But I some commands it doesn’t seem to understand. For example, if I say “set alarm to armed home” it thinks I’m trying to set a timer or alarm clock.

Am I able to make automations based around custom commands? Like if I say “arm the house” can that trigger an automation to arm my HA alarm?

Also, if I’m using Google Assistant Skill and Home Assistant Cloud do I also need Google Assistant SDK or Google Assistant Component?

You can use the Google Home App on your Smartphone to create Routines (previously known as Shortcuts). You define the phrase then set the actions Google Home should execute.

2 Likes

THANKS! I had no idea that feature was there. It works great!

I have a script which is called “house alarm”. I didn’t need to set up anything in the Google Home app (like a Routine) because I have ‘scripts’ exposed to Google Assistant and I can simply say “Hey Google, activate the house alarm” which will trigger HA to run the script.

1 Like

Dear sparkydave is it possible to send me a few example of the scripts that can trigger an automation or an actuon in Google home by Voice. Thanks a lot! My regards! Ivan

1 Like

Its nothing complicated, if you create a script and expose it to Google you can simply say ‘hey google, activate house alarm’ and the following script will run: house_alarm.yaml

house_alarm:
  alias: House Alarm
#  alias: Turn house alarm ON in away mode after an exit delay (plus the usual alarm exit delay)
  sequence:
  - service: tts.google_say
    entity_id: media_player.kitchen
    data:
      message: 'Arming house alarm in one minute'
  - delay: '00:00:30'
  - service: alarm_control_panel.alarm_arm_away
    entity_id: alarm_control_panel.house
4 Likes

@sparkydave how does one take a script and “expose it to Google”? Currently, I use HACloud and I can expose lights to GA… not sure how to expose scripts.

1 Like

Since you are using cloud:
https://www.nabucasa.com/config/google_assistant/

just have:
expose_domains: to include script

1 Like

Ah, nice!..Thanks @sparkydave I’ve not been in the Cloud docs for some time… very handy now and tons of features!
So is the only way to setup scripts to verbal phrases is to use GoogleHome shortcuts?

Curious how you link “what to say” with non-standard domains like “scripts”?

No need to setup anything in Google Home once you have the scripts exposed, they just work. As far as Google is concerned, they aren’t non-standard I guess. Saying ‘start’ or ‘activate’ will tell Google that you are reffering to the script. Also, in your HA yaml you can have ‘aliases’ for the scripts to call them something simple or different in Google Home

i dont have an ha.yaml file. is it now inlcuded in the configuration.yaml? i tried to add

cloud:
  google_actions:
    filter:
      include_entities:
        - script.1580121055861
        aliases:
         - Dammsug kök
         - dammsug köket
         - städa köket 

but get an error on the aliases line…?

I was searching now online how to do this and I did that using Scenes. Actually I needed a way to disable my automation which triggers the light by motion because sometimes I don’t need this at night :smiley:
I created a Scene and assigned the value of the automation to be OFF by clicking on the Entity. then in Google Home app I called " Sync my devices" , then go to “Routines” and create a new routine and set the action to activate the “Scene” you have created. This has worked for me now while I am writing this down.

1 Like

You have an issue with the config there i think.

Try this:

cloud:
  google_actions:
    filter:
      include_domains:
        - script
    entity_config:
      script.1580121055861:
        aliases:
          - Dammsug kök
          - dammsug köket
          - städa köket

i will try that. right now i

cloud:
  google_actions:
    entity_config:
      script.1580121055861:
        aliases:
          - Dammsug kök
          - dammsug köket
          - städa köket

and i can controll it trough google assistant, however the other 2 persons in my home can’t, so will try to add include domains and se if it solves it
thank you

edit…
that kinda made every other integrations dissapear… and i cant add them in the ui

“Editing which entities are exposed via this UI is disabled because you have configured entity filters in configuration.yaml.”

hmm

ok, so you need to only have:

cloud:

in your config and do the rest in ‘Integrations’ (as far as I know). I personally use yaml for my cloud config and only use ‘Integrations’ for certain things, not this.

i ended upp with

cloud:
  google_actions:
    entity_config:

and it seems to work (Y)

Hi, I had create a lot of scripts for google assistant to change channel on TV, it is work but I think it is can be better solution.
I have following scripts:
Set 1 channel
Set 2 channel

Set 33 channel
Is it possible to create one script with a parameters? For example: Set “number” channel?
Maybe can I write a python script? But Google assistant can’t understand this script(((

I would look at this to see how you can send the channel number to a single script

Hi, yes I tried but google assistant can’t recognize a script
Script alias: set channel
I says: Ok google, set 2 channel
Google search in the internet set 2 channel

is “activate” the only word to execute scripts?