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

Hi, since some days the broadcast is not working: when I put this URL in browser

http://192.168.1.10:5000/broadcast_message?message=Hello

I receive

{"status": "OK"}

but nothing is spoken

I added your repositary to hassio and installed the addon, my google_assistant.json is in the /share folder, I opened the addon GUI and it asks me to enter the authorisation code which I have done but then I get the following errors

‘’‘Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py”, line 627, in respond
self._do_respond(path_info)
File “/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py”, line 686, in _do_respond
response.body = self.handler()
File “/usr/local/lib/python3.5/dist-packages/cherrypy/lib/encoding.py”, line 221, in call
self.body = self.oldhandler(*args, **kwargs)
File “/usr/local/lib/python3.5/dist-packages/cherrypy/_cpdispatch.py”, line 54, in call
return self.callable(*self.args, **self.kwargs)
File “/hassio_oauth.py”, line 46, in token
self.oauth2.fetch_token(self.user_data[‘token_uri’], client_secret=self.user_data[‘client_secret’], code=token)
File “/usr/local/lib/python3.5/dist-packages/requests_oauthlib/oauth2_session.py”, line 244, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File “/usr/local/lib/python3.5/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py”, line 411, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File “/usr/local/lib/python3.5/dist-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 379, in parse_token_response
validate_token_parameters(params)
File “/usr/local/lib/python3.5/dist-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 386, in validate_token_parameters
raise_from_error(params.get(‘error’), params)
File “/usr/local/lib/python3.5/dist-packages/oauthlib/oauth2/rfc6749/errors.py”, line 415, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) Bad Request
‘’’

and then after that the gui doesn’t open as if it’s not running.

Any idea’s what I have done wrong?

I tried to add some info to the install/configure docs at https://github.com/AndBobsYourUncle/hassio-addons/pull/14/files/1014e4e4c00d3147e670914c003311eb954d5c40

Hope this helps. Not sure how to get my suggestions approved and added to the documentation, but I was able to get mine installed and working.

3 Likes

Same thing here…

IS there anyone for which this addon is working?

Yes everything is ok today. I think it was not working because of the “night mode” of my GH

works for me. virtenv on ubuntu

Ok mine works now when I put this in a browser
http://192.168.1.10:5000/broadcast_message?message=Hello

but notify.google_assistant is not working anymore. Any clue?

action:
      - service: notify.google_assistant
        data_template:
          message: 'Alarm is armed'

notify:
  - name: Google Assistant
    platform: rest
    resource: http://192.168.1.10:5000/broadcast_message

Assuming the webserver is runing on the same server as HA, try changing the IP address to localhost:

- name: Google Assistant
  platform: rest
  resource: http://localhost:5000/broadcast_message

This works for me.

I can use the notify.google_assistant service and I can send a broadcast via the web url on port 5000 but the web gui wont work.

Using Hassio on a pi3

I have 2 GH at home, is it possible to broadcast one specific GH ? thanks !

You should be able to just use the tts component for that:

1 Like

yeah thanks, I know this component, but I do not like the way it speak, it’s not smooth as the original GH

Got it. Unfortunately I think that’s your only option, as you cannot target a broadcast to a specific device.

1 Like

The only way I know of to accomplish this would be to put the one you don’t want to broadcast to in Do Not Disturb mode. You could do this dynamically but it gets quite complicated with the more assistant devices in your setup.

1 Like

Interesting idea ! How can I do that with HA script ?

The documentation for the “unofficial” API is here: https://rithvikvibhu.github.io/GHLocalApi/#assistant-assistant-notifications-post

You should be able to set up a command_line switch like this:

- platform: command_line
  switches:
    switch_name:
      command_off: >
        curl -H "Content-Type: application/json" -X POST -d '{"notifications_enabled":true}' http://<IP>:8008/setup/assistant/notifications
      command_on: >
        curl -H "Content-Type: application/json" -X POST -d '{"notifications_enabled":false}' http://<IP>:8008/setup/assistant/notifications
      command_state: >
        curl -X POST http://<IP>:8008/setup/assistant/notifications
3 Likes

They Amazon Polly voices are quite nice. You can use them for TTS on your Google Homes.

addon stopped working for me. worked great for many weeks and stopped couple of days ago.
following request is well received http://xxxx:5000/broadcast_message?message=bonjour
DEBUG:root:None
INFO:werkzeug:192.168.2.140 - - [23/May/2019 21:03:05] “GET /broadcast_message?message=bonjour HTTP/1.1” 200 -
but nothing is played on the google home.
I’m wondering if I’m not in the same case than what is described in the following thread:
https://support.google.com/googlehome/thread/2964730?hl=en
Anyone with a Gsuite account, for who this is still working ?
way to activate more debug ?
Thanks in advance for any help. Would be very sad to have to switch to TTS, addon was much better …

Yes, this is a recent problem specifically related to G Suite accounts. I had the same problem and contacted Google support. I suspected it was a Google problem because if you tell one of your GHs to broadcast a message rather than playing the message on all GHs except the originating GH, it does the exact opposite and only plays it on the originating GH. Long story short, Google have acknowledged that this a bug affecting G Suite accounts.
My fix: set up a normal gmail account and authenticate that to this add in. Bonus is that if you set the first name of the gmail account to “Home Assistant” then when the add on broadcasts a message you will hear “Broadcast from Home Assistant…”