Home Assistant allows you to create some complex automations.
Automations that in the end make your life a lot easier in some situations.
But what if you want to trigger that specific automation with a voice prompt
What you need to have set in place first:
- Google Home integration in Home Assistant or Home Assistant Subscription
- The automation that you want to have triggered by the voice
- A button helper to trigger the automation
Setting up the automation for Google Home
Create a button helper
First thing, after creating the Automation in Home Assistant, is to create a Button helper. This helper will allow us to trigger the automation vit a virtual button.
Go to Integrations>Helpers>Create Helper
You need to create a Button Helper or a Toggle Helper. Give it a name and select an icon for it then click on Create.
Set button helper to trigger the automation in Home Assistant
Now go to your automation of choice and for the Trigger configure an Entity and then click on State. Basically this allows the automation to be trigged when the entity changes the state (in our case when the Test button changes state, the automations commences)
That should be it in Home Assistant.
Check if the button helper shows in Google Home
Next thing is to open Google Home app and check for the Test button helper you’ve just created and see if you can spot it in the Devices>Linked to You.
If you cannot see it there then you need to do an extra step. For those who can see the button skip to the next step.
Show Button Helper in Google Home
If you cannot see the button in Google Home then you need to open up again Home Assistant, go to Developer Tools>States and search for you button name. In my case its: Test now i need to copy the entity name.
Next navigate to your configuration.yaml and open the file.
This file can be accessed in various ways. The easiest by far is to install the File editor extension.
Now paste the following line inside the file. Note that you must respect the spacing!
YOUR_ENTITYNAME.HERE:
expose: true
Now tell the following command to Google Home: Ok Google, Update my devices.
In a few minutes the new button will appear in Google Home.
Setup the automation in Google Home
Navigate to Automations and add a new automation.
You can set the automation to be Global (for your household) or just for you.
The for the Starters (trigger) you will select the trigger that you want, in your case a voice prompt.
And the action will be Adjust Home Devices and select the button helper.
All done! Now when you can Trigger Home Assistant automation from Google Home