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

ouch. Thanks for letting me know. will start looking for a new solution…

Here is what the error is in myactivity.google.com

As a workaround for broadcasting no longer working I installed Android-x86 in a Hyper-V VM, installed Google Assistant, Tasker, AutoInput, and Tasker Network Event Server.

I followed the guide here to get Tasker/AutoInput set up to send Assistant commands, then just tweaked things a bit so that I could send an HTTP GET to the IP of the VM with the command.

I then added the URL as a rest_command in Home Assistant and use a template in the URL to pass the variables I set everything up with.

So far it’s been working, but this is a huge hack because basically Home Assistant sends the web request, Tasker Network Event Server picks it up and triggers the Tasker task, then AutoInput literally simulates touches in the app to open the manual text entry, type in the command, hit send. The one advantage is that I can send literally any command that can be sent on Google Assistant on a phone, including playing music. I expect it’s not going to be very reliable though…

This should work with really any Android device (that supports all apps required) so anyone who doesn’t want to mess with the VM could use an old phone or buy one and just keep it plugged in at home and accomplish the same thing.

i assume you would be able to set up multiple apps like this in the same VM? i.e. for other “smart” things that can only be controlled by an app

Yes for sure, the Tasker web server can filter based on the parameters sent, so it can trigger different tasks based on what’s being sent.

For those who meet the requirements of the Google Assistant Library (i.e. arch linux-armv7l or linux-x86_64, audio capture and playback), feel free to try this workaround:

Disclaimer: this is not an Hassio add-on and I don’t intend to create one as I don’t use Hassio myself.
The following Python script is provided “as is”. With some linux knowledge this script can be run as a system daemon.

  1. You will need first to follow this guide “Embed the Google Assistant”:
    https://developers.google.com/assistant/sdk/guides/library/python/

  2. Once you’ve successfully installed the SDK and run the sample code, install Flask in the same virtual environment:
    pip3 install --upgrade flask flask-restful

  3. You may now run this Python script hotword_webserver.py

I slightly modified the provided sample code to include the web server code from @AndBobsYourUncle add-on. The web server URLs remain the same, so from Home Assistant perspective it can be a drop-in replacement.

N.B: In the Google Assistant settings on your phone, you should now see the new device registered in the previous steps. Make sure to provide an address for this device otherwise broadcasting won’t work. Optionally you can also setup the default media output for remote casting.

Enjoy!

4 Likes

According to “namdoh” (Supposedly a Google Assistant employee) in this thread, a fix is coming soon. Looks like next Friday is the ETA. Fingers crossed.

4 Likes

Did we get a fix for this yet?

I believe the ETA was for next Friday based on the posts in my link.

Hmm cant wait to get this feature back soon. Google tts is horrible comapared to the natural speaking

The broadcast stopped working, how to troubleshoot?

Read the previous posts. It is broken until Google fixes it.

@chocomega have you thought about making a component that doesnt need the webserver ?

Hope they fix it, was one of the coolest feature of HASS.

Shall we revert back to TTS?

Which Friday?

I also get this message, any solution?

Please follow the thread I posted as it had the latest updates. They tried to update but had to roll back so the new ETA is next Friday.

With Google, when they say “next”, alwasy ask in which YEAR

Hey all

I’m running this from a docker container on my QNAP NAS. When I connect to :9324 to authenticate, it gives me the following error.

400 Bad Request
Illegal key ‘ys-api/dvr/entry/grid_upcoming’

Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py”, line 733, in process_headers
self.cookie.load(value)
File “/usr/lib/python3.5/http/cookies.py”, line 556, in load
self.__parse_string(rawdata)
File “/usr/lib/python3.5/http/cookies.py”, line 620, in __parse_string
self.__set(key, rval, cval)
File “/usr/lib/python3.5/http/cookies.py”, line 512, in __set
M.set(key, real_value, coded_value)
File “/usr/lib/python3.5/http/cookies.py”, line 380, in set
raise CookieError(‘Illegal key %r’ % (key,))
http.cookies.CookieError: Illegal key ‘ys-api/dvr/entry/grid_upcoming’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py”, line 631, in respond
self._do_respond(path_info)
File “/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py”, line 659, in _do_respond
self.process_headers()
File “/usr/local/lib/python3.5/dist-packages/cherrypy/_cprequest.py”, line 735, in process_headers
raise cherrypy.HTTPError(400, str(exc))
cherrypy._cperror.HTTPError: (400, “Illegal key ‘ys-api/dvr/entry/grid_upcoming’”)

Any ideas?

Looks like it’s working again!

1 Like