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

hassio-addon
Tags: #<Tag:0x00007f203c620aa8>

#468

This must be a new assistant broadcast feature for English setting only so far, as broadcasting from Hass still works for me as it used to, with my voice settings being French.


#469

Fantastic work here, thank you. Sadly, I do not use a Pi for HA. I’ve got Odroid C2, Intel NUC and Synology (Intel). Any chance of an Intel Docker build?


#470

He has one at https://hub.docker.com/r/andbobsyouruncle/amd64-google-assistant-webserver/ assuming you’re running a 64 bit CPU (I don’t think there even are 32 bit NUCs).


#471

Thank you! The AMD threw me but a quick Google sorted that. Installing now.


#472

Thanks. Have this running in docker now on a Synology RS814+ (Intel Atom). The message says “Broadcast from [myusername] + [Message]”. Is that correct?


#473

I created my container then added the client.json. Is that why my username is being spoken?


#474

Sadly that now seems to be a thing. Started up a few days ago - it’s what most of the other recent posts on this thread are about. Seems to be related to the broadcast reply feature.

I’m also looking for a way to get rid of it. If you can’t I’ll likely make a dummy Google account with another name.


#475

Thanks for the feedback, good to know.


#476

edit: got it working, now just have to fix the “broadcast from mike” bit.

edit2: actually maybe this is not possible :frowning:


#477

How to install the 64bit version?


#478

I use your python script, but i did my setup in a LXC container instead, and change the language for french-canadian. It’s super! Thanks a lot. Someboday know if is it possible to just ear the message, witouth the annoucement “Message from Patrick” before the message ?


#479

I’ve started getting the following error recently. It was working previously, but seems to have stopped. I get an Internal Server Error when I try using the URL directly. Not sure if its something in particular I did or something else. Anyone have any suggestions on what could be causing it?

ERROR:flask.app:Exception on /broadcast_message [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.5/dist-packages/flask_restful/__init__.py", line 480, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/flask_restful/__init__.py", line 595, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/hassio_gassistant.py", line 40, in get
    response_text, response_html = assistant.assist(text_query=text_query)
  File "/hassio_gassistant.py", line 132, in assist
    text_response = resp.dialog_state_out.supplemental_display_text()
TypeError: 'str' object is not callable
INFO:werkzeug:192.168.1.1 - - [21/Dec/2018 14:23:32] "GET /broadcast_message?message=%22Testing%22 HTTP/1.1" 500 -

#480

@AndBobsYourUncle Somehow the broadcast function is not working for me. However some of the custom commands do work. I tried calling the commands with my browser:
http://hassio.local:5000/broadcast_message?message=Hallo Test

The page says “Okay” but nothing happens. Debug shows:

INFO:werkzeug:192.168.0.11 - - [31/Dec/2018 15:14:36] "GET /broadcast_message?message=Hallo%20Test HTTP/1.1" 200 -
DEBUG:root:None

My Activity only shows this:
image

I suspect this not working because in German the command isn’t “Broadcast”. We use "Nachricht an alle " (Message to all).

I tried using the custom command, but nothing happens either. Also, My Activity is showing the text without any response.
image

However, other custom commands are working (turn on the lights for example).

More of my log if necessary:

INFO:werkzeug:192.168.0.11 - - [31/Dec/2018 15:13:59] “GET /command?message=schalte%20das%20licht%20an HTTP/1.1” 200 -
DEBUG:root:None
INFO:werkzeug:192.168.0.11 - - [31/Dec/2018 15:14:36] “GET /broadcast_message?message=Hallo%20Test HTTP/1.1” 200 -
DEBUG:root:None
INFO:werkzeug:192.168.0.11 - - [31/Dec/2018 15:15:12] “GET /command?message=Erz%C3%A4hle%20mir%20einen%20Witz HTTP/1.1” 500 -
DEBUG:root:None
INFO:werkzeug:192.168.0.11 - - [31/Dec/2018 15:15:46] “GET /command?message=Nachricht%20an%20alle%20Test HTTP/1.1” 200 -

Does anyone have any idea how to get this to work?


#481

Try this and see if it works

http://hassio.local:5000/command?message=broadcast hallo


#482

Thanky for your reply. Sadly, this doesn’t work either.

The same command is working when typing it into the phones assistant, however.


#483

Thought id add. I’ve created a Google Assistant web server container for Docker based on @chocomega edits so it works with remote casting to. You can check it out here.


#484

I love the idea of this add-on, but I can’t seem to get it to work. I followed the Google OAuth steps (in fact, I’ve done that several times) and download the .json client secret. However, when I start up the app and try to do the initial authentication step, I always get the error below. I even completely rebuilt my Home Assistant server from scratch and tried to get this add-on to work as one of my first steps but found the exact same error message. Anyone have thoughts on what might be causing this? Thanks in advance!


500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

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
Powered by CherryPy 17.0.0


#485

After trying everything imaginable, I finally decided to follow this guide by Google:

https://developers.google.com/api-client-library/python/guide/aaa_oauth

That guide walked me through installing Google assistant SDK on my server, creating a project, generating credentials, etc. At the end of the guide, it generated a credentials file. I could copy the credential file over to my docker image for this add-on (copied to /data/cred.json). Finally, I could use the a.dd-on. What a headache… I still don’t understand why the add-on couldn’t handle my oauth registration.


#486

Tried to uninstall the Addon, Reinstalling it and running the whole Auth-Instructions again witha new project.
But still, I get the same result. Working Home Automation commands, but no broadcasts.

Any help appreciated!


#487

I love this add on and i’ve been using it to integrate devices where the there is no local control API such as bond home for my ceiling fans. Is it possible to get the actual response instead of {“status”: “OK”} so i can parse this message and create automations?