Unable to link Home Assistant to Google Assistant

I had in actions by google > develop > account linking > client ID

https://oauth-redirect.googleusercontent.com/r/homeassistant-27

I removed r/homeassistant-27 which is my project ID

But it still doesn’t change anything.

I don’t quiet get this part it said it was optional saying about only if multi people using google assistant in the setup instructions. Do we need it? You have retyped that saying 'name of service account.

When first set up google assistant with the new type method post 0.105 HA version, I did create and download the .json file but when I started again from fresh I didn’t use the json file.

ps my duckdns works fine I can access HA from outside my network.

Only if you want to resync.

It is the name of the json file you downloaded. Yes I removed the name of my file.

I am only showing what I have that works.

1 Like

When you are taken from the google home app to HA on your phone to authorise https://oauth-redirect.googleusercontent.com/ access do you just sign with your HA administrator username and password?

I am just thinking of what is happening at this point in the code to maybe help understand where is it coming unstuck.

It would appear HA is happy with my sign in details and redirects me back to the google home app but the linking timesout which could mean that HA didn’t populate the settings in HA thus disallowing GH to contact HA.

I don’t think anything gets changed on GH side during the authorisation side it more about populating HA with the invitation.

Maybe our HA install is messed up and has permission faults which not allowing population. Anyone know where to check in HA where the external apps authorization gets stored so we can see if it has indeed saved the request we allowed.

yeah i face same problem…

here is little history what i’ve done =

  1. installed hassio 104 with duckdns add on, everything smooth
  2. create google project service account etc… linking to home assistant without a problem, everything smooth in both side (google home, hassio)
  3. update to 104 -> 105 -> 106, this is where the nightmare begin
  4. hassio started throwing Request for https://homegraph.googleapis.com/v1/devices:reportStateAndNotification failed: 404
  5. debugging log found this
Response on https://homegraph.googleapis.com/v1/devices:reportStateAndNotification with data {'requestId': 'myrequestID', 'agentUserId': 'myagentid', 'payload': {'devices': {'states': {'group.kamar_bawah_belakang_room_light': {'online': True, 'on': True}}}}} was {
  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }
}

triple build google home project with any possibility option (oauth url, reporting state false, unlink, relink, make as minimalis as possible avoiding unrecognized state and soon you name it)
but alas none of them work… i got stuck… stuck…

=== i hope anyone could take a look at this thing ===

1 Like

In my case I have trusted_networks and trusted_users so it just whizzes past the prompt and logs me in. It is an admin user though.

My current thought is leaning towards something within HA setup which is different for some users than others. In which case are we maybe talking bug request here?

I am using Virtualbox and installed HA from the vdmk installer 3.12. I ran into plethora of issues with my previous install after I went from 0.103 to 0.107 so I am now using a brand new fresh copy of the 3.12 vdmk from the HA website eg no grannyfathered issued from 0.103.

Is the port forwarded to the correct VM?

Yes can access HA from outside network via duckdns address which is 443

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.