How to configure agent_user_id for google assistant request_sync

I’ve configured an automation to call google_assistant.request_sync when home assistant starts up:

- alias: "Update Google Assistant"
  trigger:
    platform: homeassistant
    event: start
  action:
    - service: google_assistant.request_sync

However it fails with this message, defined here: “No agent_user_id supplied for request_sync. Call as a user or pass in user id as agent_user_id.”

How do I pass in the agent_user_id to fix this?

The google_assistant integration documentation mentions agent_user_id only once in “troubleshooting the request_sync service”. I don’t really understand what it means when it says “The request_sync service requires that the initial sync from Google includes the agent_user_id.”

The suggested remedy is to unlink and relink the service in the Google Home app. I’d really rather not do that unless I have some reason to believe it will fix it since it’s a bunch of work to move all the devices into rooms.

Here’s the relevant section of my configuration.yaml:

google_assistant:
  project_id: <redacted>
  api_key: <redacted>
  service_account: !include home-assistant-google-cloud-service-account.json
  report_state: true
  secure_devices_pin: "<redacted>"
  exposed_domains:
    - cover
    - switch

Thanks for any help.

Bump, still getting this error with the latest version (0.105.4). I removed api_key because I read it’s been deprecated, but still see the same error.

same issue here

Same issue as well. How can I even find the agent_user_id?

Got it! Get the agent user ID in configuration > users > under username and then put that value in your secrets.yaml. Then call the service using:

    - service: google_assistant.request_sync
      data_template:
        agent_user_id: !secret GAagent_user_id
2 Likes

Care to explain where you find " agent user ID in configuration > users > under username" ? Is this in google console or in HA ?

Edit: never mind it’s the HA value, I was confused by the People term, but there is a second tab Users
So Settings > People > Users > [choose user from list] >

See
ID: 50xxxxxxxx834d699xxxf5754fxxxxxx
Username: ****