I’ve just setup HA on a Lubuntu VM, generated an SSL certificate, and have access to the HA web console. I’m now following instructions for setting up the Google Assistant component (I want to use Google Home to control my switches etc), and have hit a roadblock.
I’m following these instructions:
So far I have created a project on the Cloud Platform Console, and created an OAuth ID. I have download google_assistant.json and copied it to my /home/homeassistant directory (i.e. the same directory as my configuration.yaml file). I’m not 100% sure that’s the correct location for it (?). I then restarted the HA server, but can’t be sure whether the Google Assistant component started.
Anyway, I then started following the instructions here to setup the Google Assistant component:
I got to the “Setup” stage of the instructions (downloaded the gactions CLI, created project.json in the same directory, and created a new Actions SDK project in the developer console. Then I got stuck. When I ran this command:
gactions update --action_package project.json --project *****-nnnnn
I was prompted to enter an authorization code, but I have no idea what to enter.
Which authorization code do I need?
If my memory serves, when you type that
gactions... command in, it should provide you a hyperlink to go to. That hyperlink should connect you to your google account to then provide an auth code.
Did you get this far or am I off base?
Ah thanks - I missed that. So now I’ve advanced to another roadblock (!). I’m entering the Account Linking details for the app, and I need to enter the authorisation URL. Presumably this needs to be an valid external IP address? If so, then I have a problem. I run a web server with SSL on another machine in my network, so port 443 is directed to that machine. Does this requirement for SSL mean I can’t set up Google Assistant with HA unless I effectively decommission my existing SSL websites?
…if I enter the internal IP address for my HA server, then continue with the instructions - open the Google Assistant app, hit the + button and select the “Test your app” option, I get a page with this message: “Missing project id in redirect URL”
You need to get a DNS address that re-routes to your WAN IP, open the router port for HA (8123 is default) and use some sort of SSL encryption (maybe from your web server). Then when you get the DNS, that’s what goes in here:
This is what I used to get me going: https://home-assistant.io/docs/ecosystem/certificates/lets_encrypt/
Hmmm the issue is that I have another web server in my network which has SSL connections on port 443 being redirected to it. Does this mean that I won’t be able to use HA with Google Assistant?
Does this mean that I won’t be able to use HA with Google Assistant?
Not necessarily. Your HA instance just needs access to SSL certificates. I don’t believe my HA is exposed on port 443.
…So I just changed the authorization URL to this:
but I still get the “Missing project id in redirect URL” message when I try to add the device in the Google Home app
internally I can access HA from a different machine using this URL:
…so I guess my SSL cert is OK on the HA server
This is from step 2 of the setup
Maybe you need to change the json file with your DNS url? Since I have limited information of your setup and steps you’ve taken thus far, I’m kinda spit-baling ideas.
And maybe re-run the
gactions command if you do this.
You’re right - json file still contained the local IP address. So I changed it to contain:
…and re-ran the gactions update command. This time when I tried to add the device in the Google Home app it behaved slightly differently - it warned me that the site was unsafe (due to the private SSL cert), but when I proceeded it gave me the same “Missing project id in redirect URL” message
I’m a little hesitant to lead you astray. Since you didn’t start the SETUP process with a DNS address or SSL encrypted page, you may want to start over with the SETUP steps. Delete the project on the google dev console and start that process over. If you get the same result, let me know…
Good idea. One quick question before I do…should the project id in configuration.yaml correspond to the project id in the URL I get from running the gactions command (that id is much shorter - e.g. projx-7372c)? - i.e.
Yes, most definitely. It should match the project ID in the Google dev console as well.
Didn’t think you could use self signed certs for Google Actions?
That was it! I corrected the project id in my configuration.yaml and finally managed to add the device in the Google Home app, assign rooms, etc.
Now I have to confess that I have no idea where I am! What’s the next step on the road to being able to shout commands at Google Assistant and have HA respond to them?
@andrewdolphin I don’t know about the self-signed certs. My SSL is set up using the dehydrated letsencrypt.
@itm1960 Great! glad to hear it. Next step is you need to expose devices to Google using this
After exposing new entities, you’ll have to do the request_sync thing. This refreshes the exposed variables to google without having to unlink/relink the google instance.
Many thanks for all of that.
OK so at this stage my only device is a Broadlink RM Pro IR/RF blaster, which I want to teach some IR/RF codes to command my AV equipment and some remote sockets. So I should first expose the Broadlink to HA, then I guess define triggers/actions? I’ve had a look at the Automation editor on the HA console but I can’t work out (a) what type of trigger applies to Google Assistant, or (b) what type of action I need to define to get the Broadlink to fire off an IR command. I guess that Google Assistant and the Broadlink are edge cases in the world of HA, which is why these things aren’t so obvious?
Check out the Broadlink component: https://home-assistant.io/components/switch.broadlink/. Set up the devices you want to control as switches according to that documentation, then expose them to the Google Assistant component.
So if you set up your TV for example as a Broadlink switch, you’d then say “Hey google, turn on the tv” which will cause HA to turn on that switch, which under the hood will cause the Broadlink to transmit the on code to your TV.
Don’t worry about automations for now. You’d use an automation, for example, to turn on your tv when the living room motion sensor detected motion. But the point of the google assistant component is to enable voice control of (almost) any device you’ve set up in HA.