Can't get Google Assistant account linking working

Apologies in advance for the long-winded intro post, but I’m at my wit’s end, and have tried just about everything I can think of.

I’ve been running HA for a good couple of years now, and generally have no issues figuring my way through any problems I encounter, but I’m simply stumped by this one. For context, I run HA via pip install, on Raspbian, behind nginx, using a dedicated hostname, with a Lets Encrypt certificate. All functions within HA itself are working perfectly (including using it remotely via the internet), except…

At some point in the past couple of weeks or so, I noticed that my Google Home devices stopped working with the devices synced from my HA server, telling me they couldn’t connect to my Google project (by name - I think I’d called it “The house”).

At the time, I was on either 0.78 or 0.79 (not really sure which - I usually update every couple of weeks), but updated to 0.80 in the hope it would fix it. It didn’t.

More reading, and I realised that I’d missed the memo on the OAuth2 breaking change, so set about completely unpicking my google_assistant config and starting again from scratch (I only have some lights and climate controls, so no biggie to start with a clean slate).

Since then, I simply cannot get my Google Assistant to successfully setup account linking when adding in my Google project for my HA. When I go through the process (via the Google Home app), it connects to my HA server, I login (with the only user - an owner - I have), then (briefly) get the message saying “account linking unsuccessful”. The Google Home app tells me it was unable to connect.

I’ve tried a whole bunch of things I found in my searches, including:

  • setting up a brand new Google project, using the latest instructions
  • uninstalled the Home Assistant app
  • removed all unrelated Google accounts from my phone
  • used BlueStacks to try linking (essentially, a fresh Android device)
  • cleaning up all auth data under .storage, and creating new owner user
  • rebooted all three of my Google Home devices

I tried turning on debug logging, but setting the google_assistant component to debug in the logger didn’t seem to do anything, and turning on HA-wide debugging didn’t really help anyway (when I grepped back through the logs). I can see from my nginx and HA info logs that connectivity to my instance is definitely not the issue.

The only thing that stands out as a bit wonky is that, when I go to add a new home control service in the Google Home app, two older “[test]…” projects are still listed, despite me having completely removed them in my Google Actions and Cloud consoles. It feels like something with my Google account is still a bit funky.

So, any thoughts about what next steps I can take to investigate?

Cheers in advance!

So, I’m still spinning my wheels on this one. I dug deeper again to see if I could narrow the problem down to an exact release, but now I’m even more confused.

Going through my logs, I can see I ran HASS update commands on October 9th and October 21st.

BUT, looking at my Google Home activity logs, I can pinpoint my first problem with the integration to October 17th. I have a voice command I use at night that turns off all my lights, climate controls, etc. It worked just fine on the evening of October 16th, but not on October 17th, or ever since.

Is anyone aware of any changes with Google Actions around that time? I’m digging around for changelogs, but haven’t found anything yet…

Same thing here. Nothing useful to add though… except another data point.

Hi All,

I setup Google Assistant in a fresh HA (I did not use HA for a while so decided to go for a fresh config with hass.io and 0.82.1). Everything went ok until I came to the final step of linking Google Assistant to HA. Same error here: Account Linking failed. That is where it stops for me. I tried dozens of times, even recreated the service from the start (throwing away the old one, and yes also with me that one is persistent in the app). It would be great if anyone could help out. I can’t use my brand new mini now with HA.

Side question: if it gets to work, what API key to use for google_assistant.request_sync. It’s not very clear from the instructions and google give a bunch of variants.

Thx

Ralph

1 Like

I’m not sure if this will help at all with your question regarding what API key to use. It sounds like you already have the API key you require in your config but just in case you’re looking for where this info is stored, since I personally found it quite tricky to track down, here’s a guide.

Just above ‘Configuration’ at the bottom of this page: -

There’s a link to ‘Google API Console’. For me it automatically reroutes me to some API Home Graph page and it I click on ‘Credentials’ on the LH side, it doesn’t show me what I need. However…

Click on the Navigation Menu, hover over ‘APIs & Services’ and then click ‘Credentials’ it then shows me the API Keys.

Probably not what you were asking but thought I’d post anyway.

korvan, maybe it’s worth posting your config for google assistant, just in case someone can spot something. Also, could be worth going back through the setup in Google Console, just to make sure something isn’t spelt wrong.

Best of luck both

Hi all, Found the following guide.
https://www.smarthomebeginner.com/configure-google-assistant-for-home-assistant/

This helped me to set-up Google Assistant. I tried twice, once for English and after successful in Dutch, also successful.

Tip: carefully look at your language setting ( in the first step and in the simulator), the guide assumes everything in English which is a the standard setting.

Ralph

I finally figured it out! I host my DNS in Route 53 on AWS. By default, I only allowed sources from Australia (where I’m from) and the US (where I assumed most of Google was coming from) to accurately resolve my home server DNS entry. In other words, a whitelist of countries.

Long story short, there’s hits coming from Google’s data centres elsewhere in Asia-Pacific. Once I relaxed the Route 53 policy, it all started working.

Guess I’ll have to go back to just blacklisting China and Russia…

Actually I have not the same but a similar issue.
I went to every process on making my “test” Google project and finally got it to a point, where in the Google Home App on my Android phone (same user, same anything, etc.) the link new device/service works BUT
It says “Account linked succesfully” - it drops me back to the previous menu, but if I enter again in the “works with Google” menu then I see my “Test” App unlinked.
Somebody experienced the same problem?

Ah. I had it break again on me a couple of weeks ago, and had the same behaviour. Do you have the Home Assistant webapp icon installed on your phone? If so, you need to remove that first, then try the process again.

I had it both on my home screen and in my application drawer, so needed to clean it up from everywhere.

I can’t remember where I read it, but I did come across it in some HA doco somewhere…

Thank you for the reply.
I tried that yesterday. Unfortunately nothing changed.
Rebooted my phone (just in case).
Rebooted HA, tried different other phones and tablets (have at least 5 at home, so I took no chances and tried them all - different manufacturers, different Android versions) -> still no luck ;-(((
I have no IOS phones at home to test it on but I think it wouldn’t really make a difference!?!?
I read different topics where IOS works but only until the same point where I am now.
Adding the link but still unlinked.

I’d appreciate any hint, clue or tip in this matter.

I’m experiencing exactly the same problem: I can log in through OAuth2 and authorize the link with my local account. HA creates a token and the Google home app reports that the service is linked. Then it throws me back to the default smart home list instead of showing a list of devices and on further inspection, the custom action is not linked :-\

  • the google_assistant yaml config is correct according to the doc
  • I deleted and recreated the projects on GoogleActions and google cloud (for the sync API key) multiple times
  • ensured that there is no HTML5 app on the phone
  • tried local network and mobile traffic
  • even used other phones

No success :frowning:

Hi,

Anyone solved this? i’m on the same boat…get the credentials screen, but it goes to the same previous screen with all the apps that you can configure with google home.

I can’t tell you when it started working with my setup, but eventually I wanted to try the linking again and was quite surprised when I saw an active link in the Google home app.
I did not - repeat: not! - change anything on the configuration.yaml or the Google API projects. What I did change, is that I migrated from the hassio-addon for nginx to nginx proxy manager. Maybe there is something in their config…

I’m experiencing exactly the same, and thought it might be because I’m using the nginx proxy manager.

Are you using the proxy manager for the SSL certs as well? Would you mind sharing some screen shots of your proxy manager config?

EDIT:

Well, after hours of trying to get this working, I can confirm Google Assistant works with nginx proxy manager (and definitely recommend nginx proxy manager - i hate configuring nginx). It turns out in my instance, I had the wrong home assistant configuration, I can’t believe how simple the fix was, I had to comment out the below in my configuration.yaml:

google_assistant:
  project_id: home-assistant-c227d
  expose_by_default: true 
  api_key: AIzaSyDvYEY0Y5EhhMx97yRGqVnilY6Jr5HsKOU
#  exposed_domains:
#    – switch

It seems that when you have expose_by_default set to true, you don’t need the exposed domains. Including the exposed domains means that it says it’s linked in google home, but it doesn’t actually do it.

2 Likes

Maybe it’s just some weird behavior with Google Assistant when linking to a service without devices?

According to the documentation:

  • by using expose_by_default: false you need to declare each entity in entity_config. Otherwise, there will be no device! exposed_domains won’t work with expose_by_default: false (please correct me if I’m wrong here). At first, I did the same mistake because I found it more intuitive to say: Hey, don’t expose all stuff by default and instead just take those domains. And maybe, in that case, the Assistant gets an empty device list and just does ¯_ツ_/¯.

  • restricting the assistant to all devices within certain domains works by configuring those exposed_domains and without (!) expose_by_default: false

Working for me is:

google_assistant:
  project_id: !secret google_assistant_project_id
  api_key: !secret google_assistant_api_key
  exposed_domains:
    - sensor
    - switch
    - climate
    - camera #although the stream does not work at the moment, don't know why
    - input_boolean

Hi,

i have the same config on configuration.yaml:

#Google Assistant GHM
google_assistant:
  project_id: !secret project_id
  api_key: !secret api_key
  exposed_domains:
    - group
    - input_boolean
    - script
    - switch
    - light
    - vacuum
    - cover
    - media_player
    - sensor

And i have the nginx proxy manager configured too. Still the same, i can find the app, get the credentials, and it goes back to the same screen with no changes at all…i’ve already done 4 or 5 times the config and still not working for me…

any luck sorting this ?

Have you removed all instances of the Home Assistant html5 app from your device, before attempting to relink to your Google Assistant? 9 times out of 10, that’s the step that I forget.

Weirdly, despite what others have said, through my tinkering, I’ve got both exposed_by_default set and I have some exposed_domains set:

project_id: !secret ga_project_id
api_key: !secret ga_api_key
secure_devices_pin: !secret ga_pin
expose_by_default: true
exposed_domains:
  - switch
  - light
  - script
  - climate
  - cover

My setup is currently all running in docker containers (home assistant on one RasPi, in docker, and another RasPi running individual containers for nginx reverse proxy and letsecrypt.

For me the fix was to remove expose_by_default = false from my config. As soon as I did that, the
sequence worked:

  Home app
  --> Settings 
  --> Assistant
  --> Home control 
  --> ⋮ menu 
  --> Manage accounts 
  --> [Test] My app 
  --> login
  --> "Link successful" message   <---- this is the point it got up to before, then returned to the add account screen without actually linking
  --> Devices appear in a list


1 Like

I confirm that HA configuration.yaml could mess with linking your [test] Application.

In my case I added non standard exposed domains and that was the problem.
I removed them all and let it discover everything by adding expose_by_default: true

Hope this will help someone.
Cheers
Fred

1 Like