Google Assistant Explained / Config help

Just made my first run at configuring Google Assistant using this:

Got down to pressing the ‘+’ and did not see my action.
First, is there a 30,000 foot explanation on the interactions between GA and HA?
I don’t mind going done instructions step by step, but when there is an issue it nice to know how it works.
Most of the troubleshooting was about 404 errors and sync. I never saw the action in my phone app so I never got that far.

Can someone explain the connections of the “google_assistant:” parameters and how they relate to the api configurations?

Also, I have the google maps working, so I have a google maps API key. Will it work for Google Assistant (GA) or do I need to build a new one?

Here is my google_assistant.yaml:

  project_id: someproject-2d0b8
  client_id: !google_assistant_client_id
  access_token: !google_assistant_access_token
  agent_user_id: !google_assistant_email
  api_key: !google_assistant_api_key
    - switch
    - light
    - group
      name: Custom Name for Google Assistant
        - bright lights
        - entry lights
      expose: false
      room: living room

BTW, thanks to @eximo84 for his post. I was wondering what settings needed to be hidden.

Hi penright.

When using secrets it’s done using !secret VariableName not !VariableName.

Is your project id really someproject-2d0b8? That looks like the id from the setup manual and the last part is auto generated by Google. I’ll doubt you got the same exact id in your developer console.

Did you press the test button in step #3 from the setup? I think your project will only be available in your app when doing that. Navigating to the simulate page alone isn’t enough.

I made that mistake while sanitizing the config for posting.

No, I just did not change it. Is that something that needs to be kept in the secret file?
I did not think it would keep the action from showing up in the app. Will it?
Also the entities are not right, I was just getting past the initial setup first.

I think I did. There seems to be different “test” buttons, I think I got the right one.

Question, who reaches out to who? Does GA initiate communications or does HA?
Any logs that can help? HA is not posting any in regard to GA.

Please return to the Simulator page of your project and check if there is a message saying something like

Test your Actions by typing or saying “Talk to …” below or any device you’re logged into with “…”

If you can’t find this message I’ll doubt you will find your app on any of your devices…

After you got that working make sure the project id in your configuration file corresponds to the one that belongs to the project you’ve created in Google’s developer console. You can find your project ID in the project’s settings (it’s also part of the project url).

Looks like yes. Assuming I am looking at the right spot …

When I pressed the talk to my test app button, this is the error.

Question, when I am looking at the app on the phone, and I press the ‘+’ to add the action, will the action be called test something or the name of my project ID?

BTW, here is my new config …

  project_id: xxxxxxha
  client_id: !secret google_assistant_client_id
  access_token: !secret google_assistant_access_token
  agent_user_id: !secret google_assistant_email
  api_key: !secret google_assistant_api_key
    - switch
    - light
    - group
      name: Custom Name for Google Assistant
        - bright lights
        - entry lights
      expose: false
      room: living room

Is the project ID need to be block out before posting config? Is it sensitive information?

We are talking about the same spot :wink:

The service will be named [test] EnrightsHA on your phone and it should be displayed first in the list. It’s icon should be a cloud. Are you using the same account on your device and at the console?

Move your cursor above the computer icon in the upper right corner and make sure the pop up says Testing on Device: enabled. If it is pressing Reset might be of help…

I would not post my project ID but nobody could access your project without your permission if you’d post it.

Got it. I know what was confusing me. Here is a snippet …

I kept looking at the bottom, then when I did not see it I would look alphabetical. I read it as click + first and then down at the bottom. It was more at the bottom should be a +, click it, …
My bad. :flushed:

I can change it once I know the steps.

Now, I think I am into my configuration on the HA side. I am getting a 500 error. As I said, I was not worried entries when I started. Could that be my 500 error? After some googling, it makes me think I don’t have the credentials right. Do I need to treat it like a “sync error” I have been reading about?

Check your project id first. I’ll doubt its just ...ha. It should be ...ha-<FiveMoreCharacters>.

Go back to your developer console, choose your project and have a look at the browser’s address bar. The project ID is in there right after

Don’t forget to restart home assistant after updating your configuration.

It’s not. I thought I was blocking it, then I realized when I posted the screen shot it had it in it. That’s when I decided I will just change it when I get it working. I feel somewhat safe for now.

I still don’t feel good about understanding which pram goes into which field in the actions set up.
Let me use this test as an example just to get fields. Then I will delete it before I post this…



I am not sure I follow the “testing” the last screenshot. Most of what I did was dummy info, it says my be a test user and password, but don’t use real ones. So I just stuck in something.

The Client ID field. I use the value from my secrets files. google_assistant_client_id:
For the Authorization URL. I am using nginx. If I enter into a browser https://mydomainname I get my HA dashboard. Of course I did not use my real domain.

Should my google account be somewhere?
Also, can I use my api_key that I generated for geo locations, which by the way works?
What is directory information field?

The client ID belongs where you entered it. The rest looks okay too. You are logged in with your google account, so this is linked indirectly.

I strongly suggest you secure your home assistant instance using a password and attach that information to the authorization url. Nobody should get direct access to your dashboard!

You did make sure you have NGINX configured they way it is mentioned at the end of the google assistant component description?

If possible try to setup the component without having nginx in between. If that works you know where to look for the connection problems…

I do have a password. Is that what step 2d is calling the API password?
example … https://mydomainname/api/google_assistant/auth?api_password=myHApassword?

Yes. Now I am not including the port because I assume nginx handles that. Just the domain name.

  "vhosts": [
      "vhost": "mydomainname",
      "port": "8123",
      "certname": "hass",
      "default_server": true

I thought I needed nginx to have the cert/https type connection? Also it supports other domain names for me. Actually, my router updates my ddns. Then I have Godaddy with my own dns. Then I add sub domains to the CNAME. I have several different vhost in my nginx config.

Some new info (maybe) …
Still trying to get a understanding of how all this is glued together.
First stop Github. looking at the init code. I saw something about services.
So I started exploring my HA dashboard. In the services drop down, I found the google_assistant.request_sync.


So then I tried to lunch it …

Log Details (ERROR)
Thu May 31 2018 15:42:58 GMT-0500 (Central Daylight Time)

request_sync request failed: 403 b'{\n  "error": {\n    "code": 403,\n    "message": "HomeGraph API has not been used in project 61xxxxxxxxx before or it is disabled. Enable it by visiting then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",\n    "status": "PERMISSION_DENIED",\n    "details": [\n      {\n        "@type": "",\n        "links": [\n          {\n            "description": "Google developers console API activation",\n            "url": ""\n          }\n        ]\n      }\n    ]\n  }\n}\n'

Yes, that’s it. Do add this there.

I’m of no help regarding the NGINX configuration. I don’t use that myself and can’t evaluate if there is something wrong with that kind of configuration. But I sounds like trying to get assistant to work without it is no option in your situation.

Regarding the home graph error message. It looks like you’ve entered something wrong as api_key. Repeat or do the steps for generating a home graph api key. Assistant can work without it, but adding that api_key allows you to update devices without unlinking and relinking your account.

I did not see where to do that?
I reread some of the webpage. I found this in the api_key section. It talks about step 9. I only see through step 8. Am I looking at it wrong? It looks like it goes from step 8 to troubleshooting.

(string)(Optional)An API Key generated for the project from Google Console which allows you to update devices without unlinking and relinking an account (see step 9 below). If not provided then the google_assistant.request_sync service is not exposed. It is recommended to set up this configuration key as it also allows the usage of the following command, “Ok Google, sync my devices”. Once you have setup this component you will need to call this service (or command) each time you add a new device that you wish to control via the Google Assistant integration.

Yeah, it should say step 8:

If you want to use the google_assistant.request_sync service, to update devices without unlinking and relinking, in Home Assistant, then enable Homegraph API for your project:
a. Go to the cloud console
b. Select your project and click Enable Homegraph API
c. Go to Credentials, which you can find on the left navigation bar under the key icon, and select API Key from Create Credentials
d. Note down the generated API Key and use this in the configuration

Edit: the console mentioned in step a is

Rebuilt the key. I was using my other key and I think it should have worked, but now google assistant has its own. This is what I got this time.

Log Details (ERROR)
Thu May 31 2018 16:29:15 GMT-0500 (Central Daylight Time)

request_sync request failed: 404 b'{\n  "error": {\n    "code": 404,\n    "message": "Requested entity was not found.",\n    "status": "NOT_FOUND"\n  }\n}\n'

that’s nothing you should worry about right now. you need that function after everything else works as intended and you want to sync an already established connection between home assistant and google home.

you need to add your test app successfully in the google home app first so focus on that part.

i’m off for today. i wish you success :slight_smile: :+1:

@Florian Thanks for all your time.
Now that we have found some of my missed steps.
I need to understand google assistant just at a lower level. When I click on the action in the app, what is it doing? Is it using a URL connecting to my HA? What does that URL look like and can I try it in a browser?

I got the instruction from here. Step by step.

@Sunonline Thanks. Just started watching it. Since I was going to create a new project with different name, I thought I would follow the video. If I am in the right place, my projects create looks different.
@BurnsHA, first thanks for your time in creating the video. I think google may have changed it’s UI. I will watch the video and see if I can glean enough to make it work. Here is an example of what I am talking about.

After creating your project, you go to this page and see the build choice.

This is what I get first …

So I choose "Home control"

Oh back on track, but no build. So, let’s go a little deeper. I click on that tile. Then when you expand the build tab …

After a few more clicks, I am caught up.

Again, just an example. Let me finish video and see where I go. Thanks again to @BurnsHA, @Sunonline, and @Florian