Setting up Google Actions for Assistant

With the implicit granting, I suppose it’s not possible to link this to multiple google accounts is it? Like having assistant on both mine and my wife’s phones (with separate google accounts) being able to hit the same test app.

Did you check the docs for Google Assistant? Look at the last section there.

I haven’t set up but according to the doc you can:

If you want to allow other houshold users to control the devices:
Go to the developer console using address from point 4.
Under the gear icon, click Permissions
Click Add, type the new user’s e-mail address and choose Project → Editor role
Have the new user go to developer console and repeat steps starting from point 7.

Oh it looks like that was added to the docs a few days ago. I set it up before there was documentation about it. I’ll give it a shot!

Thanks @arsaboo and @vnguyen972

I’m not sure if there was more port forwarding required in the past but you definitely need to forward 443 to 8123 to get the latest DuckDNS (w/ LetsEncrypt) add-on to work in Hassio. Those articles/blogs need to be updated because multiple people have tried following those steps (myself included) without forwarding any ports and it does not work. Once I forwarded 443 to 8123, it started working. Personally, I would recommend using a different port than 443 otherwise you’re going to get a lot of port scanners and unauthorized access attempts.

Does anyone have some steps for debugging the “Couldn’t update the setting. Check your connection” issue?

I’m running HASS in a Docker container, and am using NGINX reverse proxy with Let’s Encrypt to access it.

  1. Attempting to add it from my phone causes a GET “/api/google_assistant/auth” to appear in my nginix logs, with a 301 redirect to a URL starting with https://oauth-redirect.googleusercontent.com/r/&scope=email+name (which seems right)
  2. Changing the client_id causing a clear error as expected
  3. Manually hitting the URL in my browser from the nginx logs and following the redirects leads to “https://assistant.google.com/services/auth/handoffs/auth/complete”. Is this correct?
  4. I see no attempts to connect to nginx after the auth attempt (I would expect to see /api/google_assistant)

Any advice for next steps to try?

Look I’m new to this. Just a few questions as I’m getting an error - permission denied when I enter the code after executing gactions - I go to the URL and get the code but it gives a permission denied when I enter it.

I also re-booted mt HA after entering the info in config file and it would not restart.

A few places where I need clarification and I might be screwing up.

configuration.yaml
The client_id and access_token are shown within [] - are the square brackets needed or is it just the long URL that should be entered?
I did use the [] and the config validated but when I restarted HA it just didn’t start. I also rebooted my Pi and it didn’t start. As soon as I removed the added section it started.
Also my project ID is not in the format of someproject-2d0b8 - when I went to the developer console and selected add/import project it did not give me a project name but merely prompted for me to enter a name which I did. I also set it to Australia instead of the United States - is this a possible problem?

I am assuming the customize code homeassistant: is optional and not needed to make it work?

in project.json, I assume the URL would be something like https://myduckdns.duckdns.org:8123/api/google_assistant
Now I am assuming that the URL has to be enclosed in “” as it’s a JSON file and that seems to be the syntax? I also am not sure as in one of the other threads, I see the google_assistant part of the URL is followed by /apps Is this needed??? If so it’s not included in the configuration doc at https://home-assistant.io/components/google_assistant/

WHen I ran the gactions, the URL it spit out looked nothing like https://console.actions.google.com/project/doctest-2d0b8/overview
My URL was actually like: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=xxxxxxxxxxx-xxxxxxx.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Factions.builder&state=state
Now I am wondering if I should have run it from the virtual environment? I had to use sudo chmod to make gactions executable so I’m just not sure if I should have switched to the virtual environment before I downloaded gaactions and created project.json? Going to the URL did ask me to authorize my google account which I did and I got a code to enter into putty but that is where I got the permission denied error.

That’s as far as I got.

I should probably add I’m using the Raspberry Pi all-in-one using stretch and a raspberry pi series 2.

Any advice?

no square brackets, just a long random string (not url)

Thats odd… not sure what happened there. It doesn’t matter where you run gactions from. It can be a windows desktop. What command did you use?

Does anyone have some steps for debugging the “Couldn’t update the setting. Check your connection” issue?

Following up, of course I figured it out immediately after racking my brain for 2 days and finally asking for help.

I have multiple google accounts (due to gsuite, longer story), and the account which I use for assistant / created the actions app with was different then the account which is the default for my phone. I’m assuming that even though I had the correct account selected in the Google Home app and the app appeared, when it opens a browser to authenticate, it defaulted to my other google account.

I fixed it initially by adding my other account as a Project Editor as specified in the docs. I was also able to add my original account by completely signing out of Chrome and turning off sync on my phone, so that it forced me to sign after trying to add it.

Hope this helps someone. I wish there were more specific errors.

1 Like

I ran:
./gactions update --action_package project.json --project my-created-ga-project
I will try the yaml entry without the []. I used the random long string generated as instructed in putty from
cat /dev/urandom|fold -w 120|head -n 1|base64 -w 0|tr -dc ‘0-9A-Za-z’|cut -c -80

So I removed the [] and HA starts correctly now. It should have picked up the syntax error I would have thought…

I also discovered I had entered the wrong URL in the JSON file. Corrected that. Again - is it correct to show the URL here as:

  "url": "https://my-domain.duckdns.org:8123/api/google_assistant"

specifically, are the inverted commas " " needed and is it correct to specify the port number here???

I get this error when I go to the URL it spits out and I enter the authorisation code generated:

2017/10/27 14:40:57 Unable to cache OAuth token: open creds.data: permission denied

Finnaly it work’s. The problem was in device naming. One of my lights has “unnamed_device”. I think component should expose such events in logger.

I have multiple google accounts (due to gsuite, longer story), and the account which I use for assistant / created the actions app with was different then the account which is the default for my phone. I’m assuming that even though I had the correct account selected in the Google Home app and the app appeared, when it opens a browser to authenticate, it defaulted to my other google account.

I fixed it initially by adding my other account as a Project Editor as specified in the docs. I was also able to add my original account by completely signing out of Chrome and turning off sync on my phone, so that it forced me to sign after trying to add it.

Hope this helps someone. I wish there were more specific errors.

This ended up helping me. Thanks. Even after I added my primary gmail account as a Project Editor, I continued to get the “Couldn’t update the setting. Check your connection” error.

I had to go into my Chrome Sync Settings and unsync both my Gmail accounts, and only sync the gmail account that was the owner of my Google Actions project. It successfully connected after this. It took maybe 1-3 minutes after this before the new Device showed in the home app.

I’m having the same problem. If you manage to get it working, or anyone has any insights, please let me/us know!

I think this is my final hurdle. I can’t get any actions added to my project because this fails.

Oh! I got it to work!

My Home Assistant install is from the All-In-One installer, and I had gactions and project.json in /home/hass/.homeassistant/google/ and I had tried changing ownership of those files to root and hass.

I decided to move that google folder to my home directory and changed ownership to pi, then ran the
gactions update --action_package PACKAGE_NAME --project doctest-2d0b8
command, followed the link, copied and pasted the OAuth code, and got:

Your app for the Assistant for project [my-project] was successfully updated with your actions. Visit the Actions on Google console to finish registering your app and submit it for review at [my project overview url]

and I can now see it in my Home Control list! It works! This is awesome!

Is groups exposed by default?
In config I’ve specified only lights but in GA I see group_lights.
Can it be excluded?

How does authentication work? I have a nginx reverse proxy. What would I have to setup?

edit: Created an exception for /api/google_assistant. Is this the correct way to do it? Now that endpoint isn’t secured at all (no password)

haha!. I just used sudo in front of the gactions command and it worked right away. Moving on to next steps now…

I probably should have known to do this as I needed to use sudo to chmod. It’s a bit cryptic sometimes especially when you have limited understanding and are just following instructions by rote but at least learning.

1 Like

So it’s all working. Set rooms etc for my LimitlessLED lights. Turned off IFTTT for one of the lights and Google Home still talks to it.

But if I say Hey Google make spots blue, instead of making them change colour to blue, they turn off.

Also, in the console, should I see these as new devices?? Or is this only voice control?

Mine duckdns its not working, I mean i can get a trigger from hassio to ifttt work but not the other way around, which port exactly do I need to forward? Mine is a d-link there are private and public ports