Unable to link Home Assistant to Google Assistant

Thanks @DavidFW1960! Although I have the exact same setup, still no luck:

Silly question: the JSON file needs to be in the same folder as the configuration.yaml, right?

Thanks

Hi Everybody!

After a long time after weeks, moreover months I simple deleted everything corresponding for this setup and started to re-create everything again based on @DavidFW1960 lines.

Basically @DavidFW1960 lines are not so accurate but with some thinking and creativity and of course the official manual I could finish the setup.

And viola!!! The never happened have been now happened! Now it is working!

My problem that I simply really do not know what was wrong and what could be the pain of lot of us. So will try to tell every character of my current setup and the changes from my mind, but just tomorrow as today I have no more time for it.

What is the summarize of the whole thing ins some lines (until my detailed post).

  • I use custom port with my proper router port forwarding as I mentioned earlier.
  • I also not use any secret as the official manual mentioned that we do not need it.
  • I use 2FA on my HA instance, and not as @DavidFW1960 I do not have trusted users so everything, everybody need to authenticate itself.

But with these settings the result is also ok, so the thing is really working while I never could make it working before.

Will be back ‘soon’.

I installed a fresh copy of HA from 3.12 vdmk in my virtualbox. I did only installed nginx and duckdns and put Google settings in configuration.yaml so barebone basics on fresh copy and test i could access HA over internet and still same result with adding Google home.

My next diagnostics will be;

  • Use different Google account for whole process thus eliminating my main Google account cache etc.
  • Setup docker for first time and Install HA in docker (I want to move towards this anyway I think it’s better than using VM from what I have read) this means I will be using a different installer package testing my semi educated feeling that issue is in the installer package.

well my setup is pretty standard i think… standard hassio on raspberry pi3 b+
no customized high grade techy stuff… just standard…
my network is also standard, 1 public IP behind ubiquity router with standard controller no high grade techy network stuff, no vlan, no confusing ruting nor dns, no abuse firewall… just standard

Ok!

So, trying to describe my whole reconfigure process, maybe what could help on the other users, who have the same problem what we explain earlier, and what already solved for me by the reconfiguring process, where I simply do not know yet, what was the main difference what helped.

  1. I deleted the whole GCP project.
    • (With it the of course deleted the already given token (in the corresponding JSON), and the API graph config also.)
  2. I separated my google_assistant config in/from my configuration.yaml as @DavidFW1960 showed to make this config lines a little bit more transparent for me. Until this splitting action I used the whole google_assistant config in the configuration.yaml.
    • I made the following Google Assistant.yaml with later filled references of 2 required personal data:
# Google Assistant

project_id: {GCP project ID}
service_account: !include {file name of the token downloaded from GCP console as xyz.JSON (the file is in the root of the HA config folder, near the configuration.yaml)}
report_state: true
exposed_domains:
- switch
- light

For use this separated Google Assistant.yaml config I referenced this from the configuration.yaml as:

# Manual Google Assistant integration
google_assistant: !include "Google Assistant.yaml"
  1. I made a new GCP project started from ‘Actions Console’ (https://console.actions.google.com) as in the HA manual.
    • (With random custom name, and correct language settings.)
  2. I gave a name for the action (at ‘Invocations’ menu point):
  3. I gave the proper webhook URL of my HA instance (at ‘Actions’ menu point):

    Where the missing part is the domain pointing to your instance with the proper port what you use for reach it, so for example: https://xyz.com:1234/api/google_assistant
  4. And almost finally I gave the proper OAuth settings (at ‘Account linking’ menu point):

    With the following examples:
    https://oauth-redirect.googleusercontent.com/r/xyz/ - Where xyz is your GCP project ID (not the name but the ID!) and please note the line ending ‘/’. On the screenshot you do not see the whole URL!!!
    https://xyz.com:1234/auth/authorize - With the same domain and port what I mentioned at the point 5.
    https://xyz.com:1234/auth/token - With the same domain and port what I mentioned at the point 5.
    And of course the 2 scope at the bottom (‘email’ and ‘name’).
  5. After it I just configured and downloaded the proper token JSON from ‘IAM>Service accounts’ at ‘GCP Console’ (https://console.cloud.google.com/iam-admin/serviceaccounts):
    • [Create service account] etc. as in the HA manual.
  6. Filled the Google Assistant.yaml with the already got GCP project ID, and the token JSON.
  7. Restarted my HA instance.
  8. And from the ‘Actions Console’ I started it with the [Test] button.

From that point I could configure it from Google Home without the earlier mentioned problems.

I can not see the difference what solve my problems but maybe you can with comparing it to your settings:)

7 Likes

Hi All, I have also managed to sync my Google Home with HA running on custom SSL port with letsencrypt certificate.

Thanks @Tamas.Toth.ebola for clearing out…

My issue was that I’ve used the Google Actions Console project id for the Google Actions Console Client ID. Which is stupid I now know.
Once I used the GCP project ID in the Google Actions Console Client ID all went well with linking and discovering my entities

2 Likes

(If I will have some time I will fork Github - HA, and expand/sophisticate the current Google Assistant integration manual with fresher images, moreover ani-GIFs, maybe clearer definitions for simpler understandable documentation. I have no deadline for it:) but I really would like to do it if I have some time…)

1 Like

@Tamas.Toth.ebola you are the man! :trophy:

I would like to take you down the pub and buy you a beer for working this one out… now all we need to do is find a pub that hasn’t been closed (at least they all are in Australia at moment with COVID) :beers: :beers: :mask:

1 Like

Hello Tamas, I am facing the same issue, and I am not able to understand all the steps. this portion is not clear for me
After it I just configured and downloaded the proper token JSON from ‘IAM>Service accounts’ at ‘GCP Console’ (https://console.cloud.google.com/iam-admin/serviceaccounts ) :

  • [Create service account] etc. as in the HA manual.

Please can you help

Hey guys!

I was able to fix my setup!:

I noticed my service provider account domain name was different to the new ones I create now:

Check the email domain marked in red. That was my old service provider account. The recently new one I created is marked in green. I created a key and downloaded the JSON file as instructed. It’s working now!

1 Like

Hi @vinodnx!

Sorry it is true that this part of my description is a little bit short, without the details. The reason of it that I had no more time when I wrote this, so sorry for it. If I will have some time in the official HA manual will try to show more details about it.

Until that the short answer:

You need it just in case if you want to Google Home could auto update your HA devices. If you do not need it in theory you do not need to make a service-account and generate a tokent for those service account what at last HA can use.

If you need that update you need to set up one new service-account in GCP console what I referred in my description. That service-account is a virtual user who can access your Google resources. With that service account will HA communicate with the already created Google Home ‘integration’. For authenticate the process with that service-account that account need a token (password) for itself, what you can use later in the remote component (HA in our case). For such service-account you need to generate with GCP integrated function the required token, and after this generation process you could download the token as a .JSON file. You need to reference that .JSON file in your HA configuration based on my previous description.

Hope you understand this, but if not I need to ask some time to make the final manual mutation with some screencast like aniGIFs, as that would be a little bit more time to finish.

I don’t know how could you know it but I’m really a big beer lover:D We just need some possibility for that beering as I’m in Hungary so Australia is really not so close for me:) But who know?! Maybe some years later, if COVID-19 leaves us some possibilities:(

Anyway thanks for you words!

1 Like

Hello Tamás,

thanks a lot for your reply. Your note helps lot to fix issues. now HA is running smoothly. we appreciate your contribution in HA community

Stay safe

Regards
Vinod

1 Like

Hello @Pyvarex,

i have spend 4 hours to try to relink my account in google assistant…then i go to the integration page of home assistant ( https://www.home-assistant.io/integrations/google_assistant/ ) and read :
“If you’ve added Home Assistant to your phone’s home screen, you have to first remove it from home screen, otherwise, this HTML5 app will show up instead of a browser. Using it would prevent Home Assistant redirecting back to the Google Home app”

that i never notice before…

My native language is not english, so i read 3 times and begin to understand…then i google this note text and i am here and read your advice…and remember i have a short-cut to HA on my phone…delete it and done!!! linking ok.

You save my evening! thanks

3 Likes

Lol… I have the same exact problem. After removing it from the home screen I’m able to link HA to Google Home App. Hope this help others facing the same issue.

1 Like

Today mine dont work anymore (it has been working the evening, then on the morning broken again) and this time i read another POST (https://community.home-assistant.io/t/request-for-https-homegraph-googleapis-com-v1-devices-reportstateandnotification-failed-403/148289/39 ) and the Homegraph API isnt active anymore…

I just activate again and it works!

Dont understand how it could desactivated by itself…???

I’ve just made an account to thank Tamas. First I needed to stop using the API key and change to the JSON file in my configurations.yaml, then I needed to do this step from Tamas https://oauth-redirect.googleusercontent.com/r/xyz/ with xyz being the Project ID. This part was missing from the walkthrough I followed. I know because I only followed it a week ago and it said to just have https://oauth-redirect.googleusercontent.com/ there.

When I did that, the first time it failed in the Home app, but the second time it worked.

Reading here I worked out how to expose only my switches too, so thanks for that guys. Now I don’t have double light instances in Home for each bulb.

1 Like

Is anyone using this with a master slave setup?

I think my authentication is working for Google Assistant, but in the HA Developer logs i am seeing that it can not find lights or switches, and i know that are on a slave device.

Thanks for all help
Mo

I think you’re onto something and I might be running into something similar. The setup went fine (I can see all my devices in the Google Home app and asking to sync devices works) but I can’t control all devices from the Google Home app.

After some testing, it appears that I can control my Hue and Lutron devices (which now have 2 entries in Google Home, since they were directly integrated to Google Home and now have secondary entries from the Home Assistant import) but I cannot connect my zwave devices that are connected through zwave2mqtt (the zwave controller is on another box in the house). They show as “not responding” and in the app it says “oops, can’t connect to the light”.

Edit: This is now working after rebooting the main and zwave instances of Home Assistant and the zwave2mqtt service.