Google Assistant - New Devices not being discovered by Google Home app

I setup my the google_assistant component successfully a couple of months ago and all my sonoff devices displayed in their app and been very happily using.

google_assistant:
  project_id: assistant-dfsd43
  exposed_domains:
    - switch
    - light
    - group

A couple of months on and I have added a couple more new sonoffs to HA but they don’t show up in Google home app.

If found this thread from back in 2017 and been through the suggestions such as

automation:
- alias: 'Update Google Assistant on start of Home Assistant'
  trigger:
    platform: homeassistant
    event: start
  action:
    service: google_assistant.request_sync

which produced this error in the home assistant log “Setup failed for automations: Integration not found.”

google_assistant.request_sync service is not in my list of services under the services tab
I also enabled homegraph for my project.

In all situations I have rebooted the host system after changes to no luck. Any ideas?

According to the docs you need an API key setting for Home graph to use the request sync service. It seems to be missing from your configuration?

Also, there’s a mention with this service request sync:

agent_user_id
Optional. Only needed for automations. Specific Home Assistant user id (not username, ID in configuration > users > under username) to sync with Google Assistant. Do not need when you call this service through Home Assistant front end or API. Used in automation script or other place where context.user_id is missing.

Perhaps this will help?

1 Like

That was it.

From memory now when I was setting up google assistant originally I got interrupted and then it was working so I never finished the article.

Once I finished following the instructions in the docs you linked I was not able to use the ‘call service’ as it produced and error which in the notes it said it would I think coz the resync component wasn’t activated during initial sync.

I had to go into the google home app click on ‘setup up device’ > add existing device and the delete the connection I have made with test. and then re-add it. This of course deleted all my assigned rooms which was a pain but the call service is not producing error now and my new sonoffs are showing.

Great! You can define the room assignment in HA by the way. That might save you some time in the future.

2 Likes

I just want to add my experience:
I already had the API key setup and syncing used to work, but stopped. The docs show that the test app expires and you can re-create it. This worked for me and I could resync my devices without much effort.

And there you have a reason to pay for Nabu Casa: you don’t have to republish your test app every month (or 6 weeks?). Home assistant just keeps connected to your Google devices.

I found a suggestion somewhere here to add resync as an automation that kick off every time you boot HA. That way you make a change to a device and reboot it will automagically be update with google directly. I am hoping that this will keep my test app from expiring.

1 Like

That’s smart. Can you post back with your experiences in a while?

It is working well now without errors like this.

  - alias: 'Update Google Assistant'
    trigger:
      platform: homeassistant
      event: start
    action:
    - service: google_assistant.request_sync
      data: { "agent_user_id": "<from your user the long string in the ID field>" }
1 Like

That’s good to hear. I think this should be a part of standard documentation for the Google Assistant integration. It might be a good paragraph in the troubleshooting section of the page. Do you agree and if so, would you mind if I added your automation there?

I just want to add to this, because I’ve spent a long time trying to work out where to find it… For the agent_user_id, you want to grab the value from the ‘ID’ field of your home assistant user.
Configuration -> Users -> <username> -> ID

ooo don’t understand where to get that data

data: { "agent_user_id": "<from your user the long string in the ID field>" }

image

Configuration – Users – Username (The account you want it to run under. Must be admin).
Take the field that I have marked in i red and surround it with quotes before pasting in that field.

muchas graciassss

Thanks a lot

Hi.
I always have the same error

 - platform: homeassistant
    event: start
  condition: []
  action:
  - service: google_assistant.request_sync
    data: { "agent_user_id": "<my user id>" }
  mode: single

I just put the user id (the long string)

Tengo el mismo error 404, me puedes explicar donde insertar el código? lo inserto en mi YAML y me sigue dando error, gracias de antemano.