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

I finally took the time to install your add-on without docker. Works great so far! No more interrupted music hehe
Thanks

Looks like remote casting has been fixed by google recently. Is it now possible to cast music with this add-on?

https://developers.google.com/assistant/sdk/release-notes#march_1st_2018

@AndBobsYourUncle

Any ideas what below could mean?

Log Details (ERROR)

Sat Mar 03 2018 22:42:42 GMT+0100 (Västeuropa, normaltid)

Error executing service <ServiceCall notify.google: message=<homeassistant.helpers.template.Template object at 0x631d61f0>>
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/connection.py”, line 83, in create_connection
raise err
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/connection.py”, line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 601, in urlopen
chunked=chunked)
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File “/usr/lib/python3.5/http/client.py”, line 1107, in request
self._send_request(method, url, body, headers)
File “/usr/lib/python3.5/http/client.py”, line 1152, in _send_request
self.endheaders(body)
File “/usr/lib/python3.5/http/client.py”, line 1103, in endheaders
self._send_output(message_body)
File “/usr/lib/python3.5/http/client.py”, line 934, in _send_output
self.send(msg)
File “/usr/lib/python3.5/http/client.py”, line 877, in send
self.connect()
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/connection.py”, line 166, in connect
conn = self._new_conn()
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x631d67d0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/requests/adapters.py”, line 440, in send
timeout=timeout
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/connectionpool.py”, line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File “/srv/homeassistant/lib/python3.5/site-packages/urllib3/util/retry.py”, line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=‘192.168.1.112’, port=5000): Max retries exceeded with url: /broadcast_message?message=Hel (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x631d67d0>: Failed to establish a new connection: [Errno 111] Connection refused’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py”, line 1010, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/notify/init.py”, line 137, in async_notify_message
yield from notify_service.async_send_message(**kwargs)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/notify/rest.py”, line 106, in send_message
response = requests.get(self._resource, params=data, timeout=10)
File “/srv/homeassistant/lib/python3.5/site-packages/requests/api.py”, line 72, in get
return request(‘get’, url, params=params, **kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/requests/sessions.py”, line 508, in request
resp = self.send(prep, **send_kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/requests/sessions.py”, line 618, in send
r = adapter.send(request, **kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/requests/adapters.py”, line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘192.168.1.112’, port=5000): Max retries exceeded with url: /broadcast_message?message=Hel (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0x631d67d0>: Failed to establish a new connection: [Errno 111] Connection refused’,))

Bob, any idea how it can work? I just tried something with existing addon but it didn’t work. Something like: play some music

I think this is only for the Google Assistant Library and not the Google Assistant Service (previously known as the Google Assistant gRPC API) which is used by this add-on I believe.

The library exposes a high level API and the service a low level API but I’m not sure what’s the difference between those two.

I hope I’m wrong and may be we’ll see this feature soon !

Thanks for this addon and work :slight_smile:
unfortunately can’t make it work on my side. using hassio in a vm (coreos).
Looks like it needs access to sound device …
18-03-11 20:07:25 INFO (SyncWorker_5) [hassio.docker.interface] Clean andbobsyouruncle/amd64-google-assistant-webserver docker application
18-03-11 20:07:27 ERROR (SyncWorker_5) [hassio.docker] Can’t start addon_fe49a976_google_assistant_webserver: 500 Server Error: Internal Server Error (“linux runtime spec devices: error gathering device information while adding custom device “/dev/snd”: no such file or directory”)

anyone here managed to start playing music using this ? Everything seems to work except turning on music :frowning:

Nope same here as well

Has anyone been able to broadcast to either a specific home device or a group of devices.

I’ve got multiple google homes but not all of them need to be getting some of the broadcasts.

Thanks

I’ve followed the steps to set this up on my hassio system. Previously I already set up the Google Assistant component to expose and control my lights and switches (which works great btw). So the basic process is clear to me.

Now with this plugin I can’t get my Google Home Mini to output anything. I can see my commands in the Plugin logs and they even show up under https://myactivity.google.com/ as “said broadcast {my message}” but the Google Home just continues playing music.

What am I doing wrong?

For those interested, I just started using the ‘do not disturb’ function for the rooms that shouldn’t get the broadcast and that works well.

Are your devices on the same network?

I have got 3 GH devices. As far as I understand broadcast doesnt work the way you wanted. broadcast will always send message on all GH devices currently linked under the same account.

Do you use the night mode with ‘do not disturb’ ? As you tried at 1:22 AM, it might explain it.
As Zpeed suggested, the dnd mode disables notifications such as broadcast.

yes. Hassio is running on a Raspberry Pi 3 connected via Ethernet while the Google Home Mini is on WiFi but it’s the same network.

That’s an interesting idea. Let me check when I get home from work (hopefully early enough :upside_down_face:)

what version of assistant SDK is being used currently ? Because apparently from 0.1.1 from feb this year you can cast music :slight_smile:

February 20th, 2018
The developer preview (0.1.1) of the Google Assistant Library for Python is now available. This version brings remote-casting support to the Google Assistant Library.

Google Assistant Library
FIXED Support for remote casting to Cast-enabled devices (for example, Ok Google, play Spotify on the Kitchen Speaker.

Indeed, Do Not Disturb seems to be the issue here. When I came home from work it worked like a charm but now (at 4 AM) it won’t make a sound. However I’ve checked my settings in the Google Home app and do not disturb is turned off for the device. Am I missing something? Clearly there should be more people affected by this if it just stops broadcasting messages at night.

Make sure the ‘do not disturb’ toggle is also turned off in ‘Night mode’ settings

Ugh hate the Google Home App and its settings in like 100 different places. That was it indeed, thank you! I feel like this could be useful for new users in a FAQ section of the first post.