Unable to link Home Assistant to Google Assistant

using duckDNS with nginx, port 443. followed all instructions across many many guides but really hit a brick wall now! i see my project in the home app and it directs me to my hassio (if wifi is off). I can log in and it says linking… then it jumps back to the add devices menu and my app is not linked. :frowning:

I have saved MYSERVICEACCOUNT.json to the config.yaml directory and i have included a google_assistant.yaml in my config with:

project_id: MYPROJECTID
service_account: !include MYSERVICEACCOUNT.json
expose_by_default: false
entity_config:
  switch.MYSWITCH:
    expose: true
    name: MYSWITCH

Account Linking:
clientID: https://oauth-redirect.googleusercontent.com/r/MYPROJECTID/
authorisation URL: https://MYDOMAIN.duckdns.org:443/auth/authorize
token URL: https://MYDOMAIN.duckdns.org:443/auth/token

service account for MYPROJECT: [email protected] (Service Account Token Creator, owner)

homegraph API (enabled) metrics:
Method:
google.home.graph.v1.HomeGraphApiService.ReportStateAndNotification
google.home.graph.v1.HomeGraphApiService.RequestSyncDevices
Requests Errors Avg latency 99th percentile latency
8 100% 0.019 seconds 0.033 seconds
3 33.33% 1.448 seconds 4.131 seconds

… and just as I was about to press send, I suddenly find after days of trying, it has linked!!! the last think I tried was to change from having domain switches exposed to just a single specific switch (I had previously tried exposing only lights domain but now that its up and running, turns out the lights dont link!!!). I also recently deleted everything in my nginx config page. maybe it was just time?

whatever it was, I hope the above helps

Thanks all for the good tips. To hopefully help someone else as new and clueless as me: I was hitting my head against the wall. I was able to see my test app but the request to access my service kept timing out. I found the answer was to change my port from 8123 to 443 in all areas of the instructions (using https and duckdns).

I do not know how to edit the instructions for the integration but it could use tidying up. The rest of Home Assistant is so well documented! The instructions seemed out of order and were not that simple to follow. And for newbies like me, it was hard to know both the location to physically place the JSON file and the syntax to include it. There is also an inconsistency error as pointed out above in the photos in the guide regarding the Client ID.

1 Like

Hi all,
I tried all the steps you mentioned, I set up everything for a few times with different options but it’s still not working for me… I’m using duckdns, the ssl with nginx is working fine, I can put my username and password for a successful login but then I’m redirected to the device linking page in the google home app.
For the config I also tried to put an extra file the google config, I included the account-json which is in the same directory, but I also tried to put the key and client-email directly in the google config, but it’s still not working…
Here’s the line in my configuration.yaml:
That’s my Google-Assistant.yaml file right now:

# Google Assistant
project_id: {my-project-id}
service_account: !include "{name-of-the-service-account-file}.json"

I deleted everything else to just get the account linking working…

I’m using NGINX for the ssl and since the documentation of the google home integration mentions that there shouldn’t be a trailing “/” at the end of the proxy_pass, I also checked that and yes, there is no trailing “/”, so it should be fine I guess…

I don’t even see any error in my Google API metrics, there are no requests at all… any idea?

1 Like

Here’s my working config, it’s also behind reverseproxy but i’m using caddy but that shouldnt matter. Can you enable debug logging for the google-assistant integration? The trick for me was to disable both report_state and expose_by_default as well as linking HA through the google assistant app and not through the google home app. Also check the permissions fo the service_account and the api-scopes. Also check for logon tokens, and clean them in HA

Here’s log settings, google_assistant.http should be enough:

GA Config:

GA Entities:

Caddyfile:

1 Like

I was struggling with getting the integration to work as well. Similar experience to most people on this thread: After selecting the Home Assistant test integration in Google Assistant it would show me a “Home Assistant linked” message, navigate me around some screens and drop me back into the home screen of Google Home, without any devices actually added. When I go back to the Integrations screen in Google Home, Home Assistant would be listed among the non active integrations.

After some more testing I was able to get it to work. I was using a configuration with exposed_by_default set to false and no exposed_domains. I was exposing a single entity through entity_config. However, even though the documentation states otherwise, without expose: true the entity would not get listed. And apparently if there are no exposed devices Google Assistant silently fails the integration (as in saying the integration was successfully linked, when in reality it wasn’t).

Adding expose: true to the single entity makes Google Assistant correctly show me the device as an available device when I link it to Home Assistant and the integration now successfully links when I select that device to be added to Google Assistant.

I’ve had same trouble. I get to enter the userID and password in Google Home Add new linked service. It does its thing then comes back with “couldn’t update the setting check your connection home assistant”. Made my way through all previous responses above and finally several of the suggestions in combination have worked - at least I’ve gotten to the point where the service now sticks as a Linked Service in Google Home. I’ve only got one domain exposed “light”. I tried “hey google lounge light on” and it worked!!!

FYI - I thought it might have been a firewall issue and disabled the firewall but still got the same problem. So … here’s my setup that works to date:

Router firewall - on.
Router forwarding LAN port 8123 and Public port 443 Protocol TCP
HA version 234 installed on Raspberry Pi 4, wired connection rather than wireless.
See images below for configuration.yaml and google configuration. Its the combination of the specific configuration I’ve mentioned below that made it work in the end:

expose_by_default: true [when it was false it didn’t work].
fullfilment URL doesn’t have a “/” on the end.
fullfilment URL doesn’t include the port number [:8123 in my case].
Account linking Client ID is as shown and not the one that ends with your project ID.
Account linking Client ID ends with a “/”.
Account linking Authorization URL doesn’t include the port number.
Account linking Token URL doesn’t include the port number.

As soon as I put the port number in any of the above, it wouldn’t work. In fact I wouldn’t even get the login screen in Home Assistant when trying to add the linked service.

CONFIGURATION.YAML

# Link to Google Assistant
google_assistant:
  project_id: abc-xyz-123456
  service_account: !include Accname-randomnumber.json
  report_state: true
  expose_by_default: true
  exposed_domains:
    - light

GOOGLE CONSOLE ACTIONS VALUES
Fulfillment URL
image

Account Linking
AccountLinking

I’ve just added additional exposed domains so the configuration.yaml is:

  exposed_domains:
    - switch
    - light
    - scene
    - script
    - media_player
    - climate
    - sensor

I then said “Hey Google, resync my devices” and it did. Devices tried so far. I only mention this as earlier posts suggested starting out with only one exposed domain.

Also, I’ve found a wired Raspberry Pi works better with Google Home than a wireless. For some reason when I had the Pi connected wirelessly Google Home if it wasn’t being used for hours lost the connection to HA on the Pi.

Thank you all! I finally got some time to try some more things you suggested but nothing seems to work… One question: did you do the google action test? And did it work? What does it do? For me it says that the action in not available in the simulation… Maybe that is the issue?

The solution in my 16 August still works OK. But I’ve never been able to get a successful test in the Google Action Test. Don’t know what the issue is. But it doesn’t affect the working solution to date so have not bothered with the Google Action Test. Hope that helps.

1 Like

thought i had read that it worked with 2FA but disabling worked for me

Hi there,
I was facing some problems until i watched this video
https://www.youtube.com/watch?v=OGiDPIx_mVQ
Includind the .json file did not work for me but i did it like in the video at it works now, just be careful to put in “” your project id also.

i had been using for two months with not problem google home in hassio (virtual box), so i moved all my system to RB pi4, did all the steps (at least 10 times from scrash), but at the moment the add in the google home app my [test]XXX i get a message that says “something went wrong, try again”, now i tried to get back to VB and i got the same message, i had been using the same duckdns address as I tried to move all as is used to be, can be related to this? now I’m in a no more ideas mood

Same here.
Solved just by adding at least one entity/device to be synced with Google Home.
If like me, you try to link Google Assistant to a fresh new HA install, be sure to add one device first.
If Google Home has no devices received from HA, your [test] Home assistant won’t show up in the Associated Services list.

I believe the Hubitat GH integration messes up HA integration into GH. My HA app links and shows devices without me having the opportunity to choose them. I found that the device count is the same as my Hubitat integration in GH. Looking through my devices there are duplicates of all of my Hubitat devices. The duplicates show they are linked by my HA integration. My next step is to unlink Hubitat and see if that resolves the issue but I’m not ready to drop Hubitat integrations yet.

Edit:

I bit the bullet and unlinked Hubitat and made sure the devices were gone in GH. After linking HA the devices are back but say manufactured by Hubitat. I also forgot to mention that none of the linked devices are in HA yet because I wanted to be able to control them with my voice.

Edit 2:
If I disable the Hubitat integration in HA, my integration setup in GH just kicks out like others have reported. I use port 8123 with DuckDns. Does it have to be 443? Or is pointing the GH setup stuff to 8123 sufficient?

Thanks for any help.

Edit 3:

Not sure what I did diffently but after fiddling with the action and regenerating the keys and updating my config several times it works. And with the Hubitat addon still working. Now I can slowly migrate my devices that required GH to HA. I did change the yaml a bit to:

expose_by_default: true
#exposed_domains:
#  - switch
#  - light
#   - camera
#   - scene
#   - sensor
#   - script

Not sure if that did it but I’m not messing with it to find out :grinning:.

Hi, sorry for reviving a dead topic. I had a similar issue I thought I would document for future googler’s.

I had my setup working for ages with DuckDNS, this week I migrated to CloudFlare and made a new project rather than go through and change anything. When I added HA to Google home, it authenticated and then silently failed. I could see 404 errors in the google console.

After trying everything including making two new projects. I’d given up for the day, then I suddenly remembered. I had geoblocking enabled. Sure enough checked cloudflare logs, and there’d been multiple attempts from the US to access my domain. Turned them off and voila!

I think it’s probably a very niche issue, but still could be useful to someone?

3 Likes

I encountered similar issues with Google Assistant device sync not working out of the blue and the turns out the culprit was also Cloudflare, but in my instance it was the “Known Bots” firewall rule and not GEO IP location.

After disabling the rule I was able to get Google Assistant to successfully sync devices again.

Anyone experiencing sync issues that uses Cloudflare for DNS management should review firewall > overview to ensure nothing is getting blocked on the Cloudflare side before it reaches your firewall.

1 Like

hey, are you using CFs teams for that? I’m considerfing that myself

I was just using the standard CF DNS management. I’m not sure what CF teams is.

The standard free tier of CF DNS allows for 5 firewall rules.

Yep, that made the trick for me as well. Did not remember either about the geoblocking in CF, so that solved the issue. Although I’m not really comfortable letting incoming US connections to my server.

1 Like

Hey, today google reported that my Home Assistant is not available.
Did all the usual checks, reachable from outside etc.

So I tried unlinking and linking the app again, unfortunately now when I enter username and password nothing happens and it stays under Unlinked.

Tried creating a new action etc and following the documentation, the new service behaves the same.
Also tried with a phone that doesn’t have Home Assistant installed nor does it have html5 app.
Also tried different google account.
Also tried different Home Assistant server which has an older snapshot.

I did not update or change anything… any ideas?