New google_assistant component

Hi all,

I have followed the tutorial here several times, and am still having the same issue:

Towards the final step, when I try to add my device to Home Assitant (iOS) I get the following error:

{"message": "missing project_id in redirect_uri"}

I’ve tried creating new projects from scratch and going through the tutorial again, but no dice. I know that those two variables exist in the assistant.json, but not in project.json in the tutorial.

Some assistance much appreciated

In your configuration.yaml you’ll have to include the Project ID as shown below:

This can be found in your google developers page when you click on your project. Then click the settings cog and click project settings.

image

You should see your project ID in the next screen that loads:

Thanks, I have that entered correctly. I double checked, just to be sure.

google_assistant:
  project_id: mine-0000
  client_id: 40690935902752k5734hhnpf5eua2o.apps.googleusercontent.com
  access_token: 24592582sdf-Z5sLgYt
  exposed_domains:
    - switch
    - light
    - group

You should redact your client ID and access tokens. Still thinking about this issue.

EDIT:
Now that I say that, you’re client ID looks weird to me. I don’t recall seeing anything .com in my strings that were generated by running the command in the walk-thru.

So I recreated my action again in google, and removed the client_id and access_token that I had. These where the google project ones. I regenerated new credentials and tried again. Making some progress it seems.

{"message": "invalid client id"}

I doubled checked the id and it matches in configuration.yaml and my google action.

I’ve gotten further now. I put my google action credentials in the client_id and access_token again, and the error went away. Now I can see the connection hitting my HA server, but on my iOS device it continues as if the device is going to be added, but then errors out with “Something went wrong, try again”

Is it also the addon installed on your HA device?

Can you post your configuration.yaml? Where did you install gactions?

Long read, but you might want to check out this thread:

I’m not sure what you mean by addon. I am using the raspberry pi version of google assistant. For my phone it’s an iphone6s with HA and Google Assistant app installed.

Thanks for the thread, I am continuing to look at it. I tried removing the other google accounts from my phone, but didn’t seem to help.

Here’s my config.

homeassistant:
  # Name of the location where Home Assistant is running
  name: Myhouse
  # Location required to calculate the time the sun rises and sets
  latitude: !secret homeassistant_latitude
  longitude: !secret homeassistant_longitude
  elevation: !secret homeassistant_elevation
#  radius: 100
  # Impacts weather/sunrise data (altitude above sea level in meters)
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/Toronto
  # Customization file
  customize: !include customize.yaml
  packages: !include_dir_named packages

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

http:
  base_url: ha.myhost.com:8123
  api_password: mypass
  ssl_certificate: !secret ssl_certificate
  ssl_key: !secret ssl_key
  #server_port: 443
  trusted_networks:
    - 192.168.1.0/24
    - 127.0.0.1
  ip_ban_enabled: True
  login_attempts_threshold: 3


tts:
  - platform: amazon_polly
    aws_access_key_id: !secret aws_access_key_ID
    aws_secret_access_key: !secret aws_secret_access_key
    region_name: 'us-east-1'
    text_type: text
    cache: True
#
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant. For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

light 3:
  - platform: lifx

# Enables support for tracking state changes over time
history:

device_tracker: !include_dir_merge_list device_tracker

# View all events in a logbook
logbook:

# Track the sun
#sun:
light:
  - platform: hue
    host: 192.168.1.223
    filename: phue.conf
    allow_unreachable: true
    allow_in_emulated_hue: true
    allow_hue_groups: false

light 2:
  - platform: hue
    host: 192.168.1.224
    filename: phue2.conf
    allow_unreachable: true
    allow_in_emulated_hue: false
    allow_hue_groups: false

    # Google Travel Time
    #
sensor 5:
  - platform: google_travel_time
    api_key: mykey
    origin: zone.home
    destination: zone.TG
    name: V to Work
sensor 6:
   - platform: google_travel_time
     api_key: mykey
     origin: zone.TG
     destination: zone.home
     name: V from Work

# Weather prediction
sensor 8:
  - platform: darksky
    api_key: !secret forecast_key
    forecast:
      - 1
    monitored_conditions:
#    - summary
#- precip_type
#      - precip_intensity
      - precip_intensity_max
      - temperature
#    - dew_point
      - wind_speed
#    - wind_bearing
      - cloud_cover
      - humidity
      - temperature_max
      - temperature_min
#    - nearest_storm_distance
#      - minutely_summary
#    - pressure
#    - visibility
#    - ozone
    update_interval:
      minutes: 5
sensor 2:
  - platform: mqtt
    state_topic: 'pi/temp_c'
    name: 'Temperature'
    unit_of_measurement: '°C'
    value_template: '{{ value_json.temp_c }}'
sensor 3:
  - platform: speedtest
    minute: 30
    #hour:
    #  - 0
    #  - 6
    #  - 12
    #  - 18
    monitored_conditions:
      - download
      - upload

#sensor:
#  - platform: yr

# Text to speech
#tts:
#  - platform: google

group: !include groups.yaml
#automation: !include automations.yaml
script: !include scripts.yaml

mqtt:
  broker: mqtt.myhost.com
  port: 8883
  username: !secret MQTT_username
  password: !secret MQTT_password
  certificate: /etc/ssl/certs/ca-certificates.crt

zone:
  - name: TG
    latitude: 000
    longitude: 000
    radius: 120
    icon: mdi:work
  - name: HTB
    latitude: 000
    longitude: 000
    radius: 80
    icon: mdi:school
  - name: bob
    latitude: 000
    longitude: 000
    radius: 100
    icon: mdi:account-circle
  - name: BBK
    latitude: 000
    longitude: 000
    radius: 70
  - name: Maura's
    latitude: 000
    longitude: 000
    radius: 50
  - name: Sports Stadium
    latitude: 000
    longitude: 000
    radius: 90
  - name: Arena
    latitude: 000
    longitude: 000
    radius: 90


digital_ocean:
  access_token: 0000

emulated_hue:
        listen_port: 80

google_assistant:
  project_id: arya-c6049
  client_id: 000.apps.googleusercontent.com
  access_token: 000
  exposed_domains:
    - switch
    - light
    - group

Did you chance your client_id and access_token when you posted your file? Project_id looks to be correct.

Is your homeassistant instance running on an https? I see the SSL info, just want to confirm.

Where did you install gactions? Are you running on a Pi? What installation method did you use (hassbian/hassio/etc)?

yes, I cut out the numbers of the id and secret.

I have gactions both in /home/homeassistant (home for my HA instance) and also in /usr/bin

Yes, this is a pi3 on stretch not hassio,

update: yes, and the site is SSL both internally and externally, I have an internal DNS

I mean, are you using the Hassio Addon


or only the new component?

I’m not running hass.io, is that addon still available?

1 Like

yes, it is. And you can use it aside the component. In some way it works better because for example you can ask for the state of your sensors, but obviously you also have to use dialogflow to make it work. Anyway, I asked if you were using the addon because I have the same error when GA asks me if i want to “link” my test app. If I don’t it works anyway but if i could be able to link it probably I’d could use my test app commands directly, without asking to GA to talk to my test app

Interesting, not sure how to install that without creating an entirely new version of hass.

OMG, I figured it out. finally.

So, the issues in the instructions are that the client_id and acess_id have to be the ones given by google, not randomly generated ones, that got me through the first error, the second error was because I have several google accounts, and with the confusion the action was setup in a different account that I expected.

The FINAL resolution, where google assistant would be about to install the device, but then fail is because your HAS has to be running on 443 (for ssl) not 8123. I got around this by setting a firewall rule.

Thanks everyone for your help. Now to figure out how to make this work with my assistant on RPI

1 Like

I’m having the same issue but I can’t get past it. Exactly where on google’s website did you get those IDs?

I didn’t get the client_id and acces_token from anywhere on the site i just made it up randomly put it in to my configuration file and copy pasted it in the account linking tap on the actions page. And every thing seems gto be working as it should.
The only thing i took from the actions page was the project id (which is the last part of the url, whne you have the project open in the browser)

I used the client_id and client_secret from the assistant.json file that you downloaded when you setup your project in google cloud. Now I’m not sure if the random codes work, but this worked for me.