Community Hass.io Add-on: Google Assistant Webserver (broadcast messages without interrupting music)

@anon35356645

I’m not sure what is not working for you. Do you mean that when you type in “turn on the light” into your UI, then it doesn’t do anything?

Does some light turn on if you open the link in the browser, and it doesn’t turn on if you use the UI?

Just realized there is a way simpler way of getting this running on a non-hass.io system using the pre-built image.

Here are the steps:

Here are the more simplified steps to get it running on a non-hass.io system:

  1. Follow the instructions here to get the google_assistant.json file: https://home-assistant.io/addons/google_assistant/

  2. Create an empty folder somewhere to put the client.json (renamed from google_assistant.json) and an empty options.json files.

  3. Run this line (substituting /full/path/to/json/folder with the full path to the two json files):

    docker run --restart always -d -p 9324:9324 -p 5000:5000 -v /full/path/to/json/folder:/data --name google-assistant andbobsyouruncle/armhf-google-assistant-webserver:0.0.3

  4. After it starts up, go to http://[LOCAL IP]:9324 to authenticate with Google.

  5. Now you can go to http://[LOCAL IP]:5000/broadcast_message?message=[MESSAGE]

4 Likes

2-3 commands I tried they all work in the browser, and not in the UI

Hmm, yeah, so then I’d say there is probably something wrong with the automation or scripts

Post your automation with the fixes.

##############  TTS
  - alias: Broadcast message
    trigger:
      platform: state
      entity_id: input_text.broadcast_message
    condition:
      condition: template
      value_template: '{{ (states.input_text.broadcast_message.state | length) > 0 }}'
    action:
      - service: script.send_broadcast
  - alias: Send Google command
    trigger:
      platform: state
      entity_id: input_text.google_command
    condition:
      condition: template
      value_template: '{{ (states.input_text.google_command.state | length) > 0 }}'
    action:
      - service: script.send_google_command
  send_broadcast:
    sequence:
      - service: notify.google_assistant
        data_template:
          message: '{{ states.input_text.broadcast_message.state }}'
      - service: input_text.set_value
        data:
          entity_id: input_text.broadcast_message
          value: ''
  send_google_command:
    sequence:
      - service: notify.google_assistant
        data_template:
          message: '{{ states.input_text.google_command.state }}'
      - service: input_text.set_value
        data:
          entity_id: input_text.google_command
          value: ''
notify:
  - name: Google Assistant
    platform: rest
    resource: http://192.168.1.238:5000/broadcast_message
  - name: Google Assistant Command
    platform: rest
    resource: http://192.168.1.238:5000/command

input_text:
  broadcast_message:
    name: Broadcast Message
  google_command:
    name: Google command

Should that be notify.google_assistant_command?

2 Likes

yes!!

have gone through the code 50 times and I didn’t see it. Thanks.

Now last (minor thing), when HASSIO starts in the box its written UNKNOWN which you have to cancel before typing in. Any way to remove it automatically when it starts?

With an input_text component, there is an “initial” config that you can use to populate it with the initial value.

Try something like:

input_text:
  broadcast_message:
    name: Broadcast Message
    initial: ''
  google_command:
    name: Google command
    initial: ''
1 Like

Somehow I recieve this message within the add-on:

[Info] Install/Update service client_secrets file
[Info] Start WebUI for handling oauth2
Traceback (most recent call last):
  File "/hassio_oauth.py", line 76, in <module>
    user_data = json.load(data)['installed']
KeyError: 'installed'

My Google Home is already configured and working but not hoped for the get this add on up and running.

1 Like

Have you included client.json per the instructions?

1 Like

@Imperial-Guard

This is due to a missing google_assistant.json file as per the docs here:

Created a new ID and it’s working thanks for the support !

1 Like

Is a script needed for broadcasting a message or can this be also done in a automation directly?

For example what to send a push notification I use:


  action:
    -  service: notify.ios_iphone_xx
       data:
          title: "Deurbel"
          message: "XX, er staat iemand aan de deur!"

To create a notification component for this add-on, you could do this:

notify:
  - name: Google Assistant
    platform: rest
    resource: http://[HASSIO LOCAL IP]:5000/broadcast_message

And you will then have notify.google_assistant that you could use just like your iOS example above.

A great thanks for your quick help! Another question any ideas how to raise only the broadcast volume?

No problem :slight_smile:

And yeah, I’m not too sure if there is a way to only increase the broadcast volume. I believe it just uses whatever the volume you have set for the Google Home.

Thanks, Is there any way to have all broadcasts synced across all Google homes? It sounds like I have an echo because I can hear 2 google homes at the same time.