Google Assistant won't add devices from Home Assistant

Hi!
I’m trying to connect Google Assistant to Home Assistant and using this guide: https://home-assistant.io/components/google_assistant/

Which seems official. I have done everything right (I believe…:thinking: ) But when I go in to the “adding device” tab in google assistant and click the “[test] Home assistant” line it loads and goes in to the browser then back to google assistant app and displays a box at the bottom: “Couldn’t update the setting. Check your connection”. Because I have an api-password to my HA I’ve added it to the authorization url in the Google Actions (in the project) like: https://[DOMAIN-NAME]/api/google_assistant/auth?api_password=[PASSWORD]

Do someone know how I can fix this?

Is your home assistant installation available on the internet on https port 443? I have mine on a different port than that and that has to be reflected in the url in the google action for it to work correctly.

Please note that the SSL-cert also has to be valid, it can be self signed, but has to be valid. (I replaced mine with a valid “Let’s Encrypt” cert to be completely in the clear.)

Like I said. I have done exactly what it says in the setup. SSL certificate from let’s encrypt is all ready done including the port 443 rediricting to 8123 for https. I can also say that I have tested to connect to the home assistant outside the Network/WiFi (4G). Which has worked.

If you can show your google_assistant config setting and also gaction then I might be able to help. I just finish my google_assistant setting few days ago.

You have to complete every step from https://home-assistant.io/components/google_assistant/

I use the basic guide setup from https://www.youtube.com/watch?v=Xk0CafW4_Pg&t=944s
Mine don’t display exactly the same when build the SDK.But it’s works. May be google part have change to match the smart home skill.

In the configuration.yaml in homeassistant:

google_assistant:
project_id: [PROJECT ID]
client_id: [RANDOM URL SAFE STRING USED IN GOOGLE ASSISTANT APP CONFIG]
access_token: [RANDOM URL SAFE STRING]
agent_user_id: [EMAIL]
api_key: [API KEY FOR HOMEGRAPH]
exposed_domains:

  • light

In the gaction project.json:
{
“actions”: [{
“name”: “actions.devices”,
“deviceControl”: {
},
“fulfillment”: {
“conversationName”: “automation”
}
}],
“conversations”: {
“automation”:
{
“name”: “automation”,
“url”: “https://[DOMAIN]/api/google_assistant”
}
}
}

  project_id: !secret google_project_id <== the project name from google
  client_id: !secret google_client_id  <== this create from ssh " $ cat /dev/urandom | fold -w 120 | head -n 1 | base64 -w 0 | tr -dc '0-9A-Za-z' | cut -c -80 "
  access_token: !secret google_access_token  <== this create from ssh " $ cat /dev/urandom | fold -w 120 | head -n 1 | base64 -w 0 | tr -dc '0-9A-Za-z' | cut -c -80 "
  agent_user_id: !secret google_agent_user_id  <== I use email. the same emailA from ADD SCOPE in google
  api_key: !secret google_homegraph_api_key <=== from homegraph api
  exposed_domains:  <== I didn't use this anymore but to check if all devices from these domain works well with google assistant
    - switch
    - light
    - scene
    - script
    - media_player
    - climate
    - cover
    - fan
    - group

in gaction, at url
“url”: “https://[DOMAIN]/api/google_assistant” <== https://yourdomain.duckdns.org:8123/api/google_assistant

Should the client_id be the same you had in google assistant project in account linking phase?

If so, I’ve done everything like you said… I don’t use port on the url in gactions though because I’ve portforwarded the external to 443 and the internal 8123…

The only problem I can think of is when I go into the “auth” url my self (in my browser) it says: "message": "missing redirect_uri field"

client_id is not the same as google assistant project.

client_id: !secret google_client_id  <== this create from ssh " $ cat /dev/urandom | fold -w 120 | head -n 1 | base64 -w 0 | tr -dc '0-9A-Za-z' | cut -c -80 "
access_token: !secret google_access_token  <== this create from ssh " $ cat /dev/urandom | fold -w 120 | head -n 1 | base64 -w 0 | tr -dc '0-9A-Za-z' | cut -c -80 "

No, client id and project is not the same…

you don’t need to forward port from your router from 443 to 8123. but you have to specific the port you use for your ha in project.json (gaction).

No I don’t need to specify the port number because I use https and have opened 443 it says it in the setup:

“This must be an HTTPS URL to work. Don’t forget to include the port number if you’re not using port 443”

At https://[DOMAIN-NAME]/api/google_assistant/auth?api_password=[PASSWORD] <== at here did you put home assistant port? 8123

At gaction in project.json <== the “url”: “https://[DOMAIN]/api/google_assistant” <== at here did you put home assistant port? 8123

If you have done everything except put the port. Give it a try put with home assistant port ^^

Don’t forget to reboot.

I have the same problem use port 443 and api password too. Google Assistant component, failed to setup. 401 error

some problem here. I am using HassIO, not redirecting port 443 but directly using 8123. all the rest (google tts for example) works fine.
any clue?

tried (almost) all the suggestions here and in the other similar posts, nothing works!
not exposing by default and manually enabling some lights, I can avoid the “couldn’t update the settings” error and I can get “successfully linked…” but then no account or device appears