This will enable you to broadcast a text message to all Google Home devices without interrupting your music that is currently playing.
It is extremely useful for when you want an alert to play based on some automation, but you donât want to interrupt and stop the current music or anything.
Feel free to let me know any comments/suggestions.
Itâs actually pretty straightforward, as I had to do that when developing it out.
Here are the steps (these steps have been deprecated in favor of the ones underneath):
Clone the repo.
cd into the âgoogle-assistant-webseverâ folder
Put that file that you need to name âgoogle_assistant.jsonâ in that folder, but name it âclient.jsonâ
Create an empty file called âoptions.jsonâ in the same folder
Add the following two lines to the end of the Dockerfile (but before the entrypoint line):
VOLUME /data
COPY *.json /data/
Build the docker image with the following line (Raspberry Pi 3):
docker build --build-arg BUILD_FROM=âmultiarch/debian-debootstrap:armhf-stretchâ -t google_assistant_webserver .
Or for amd64 type devices:
docker build --build-arg BUILD_FROM=âmultiarch/debian-debootstrap:amd64-stretchâ -t google_assistant_webserver .
Run it using this line:
docker run --restart always -d -p 9324:9324 -p 5000:5000 --name google-assistant google_assistant_webserver
Sometimes you might need to stop and remove the container if you build multiple times. Hereâs the line for that (this will force you to have to use OAuth to authenticate again):
docker stop google-assistant && docker rm google-assistant
After it starts up, go to http://[LOCAL IP]:9324 to authenticate with Google.
Now you can go to http://[LOCAL IP]:5000/broadcast_message?message=[MESSAGE]
EDIT:
Here are the more simplified steps to get it running on a non-hass.io system:
Create an empty folder somewhere to put the client.json (renamed from google_assistant.json) and an empty options.json files.
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
After it starts up, go to http://[LOCAL IP]:9324 to authenticate with Google.
Now you can go to http://[LOCAL IP]:5000/broadcast_message?message=[MESSAGE]
As you are building an image that includes your Google client secrets, I wouldnât publish it. There are more steps involved in not copying the JSON files, but mounting a volume that contains them. Itâs not too big of a deal though unless youâre thinking of publishing it.
Oh, and I sorry, I mightâve misinterpreted your question. If you were asking how to do this without using docker at all, that might be a bit more complicated.
However, itâs extremely easy to install docker on a Raspberry Pi, as there is just a single command that should set it up completely for you: curl -sSL https://get.docker.com | sh
yeah Iâve got Docker running on my server, so thatâs not an issue. Was curious if I could get it integrated into my current home assistant container. Anyway to get this integrated into the official Google Assistant component?
If you have your on custom docker setup running Home Assistant in a container, then Iâd say itâs best to leave it running as its own separate container.
The more compartmentalized you have your docker setup, the more manageable it is.
As to getting it integrated into the official Google Assistant add-on, I guess I could fork it and create a pull request to get a configuration variable added to the options.json to make it start in text mode instead of speaker/mic mode (but thatâd require using Hass.io).
But I donât think there is currently any way to run âyour ownâ Google assistant in Home Assistant without running it separately. So, itâd currently either have to be with Hass.io or a custom docker container. The Google Assistant component merely connects to Google to provide your Google assistants with the ability to control your lights and such. I have that running on my HA setup as well.
So basically, this add-on is actually a full-fledged Google Assistant that can do everything a Google Home can do (just like the Hass.io Google Assistant add-on).
The only difference is that it uses their RPC modules to simulate typing whatever it is you want it to do, versus saying it out loud.
And then the webserver merely crafts a message like âBroadcast [YOUR MESSAGE]â, and it would be like telling your Google Home out loud the same thing.
Actually, come to think of it, there is a lot to be expanded upon here.
For instance, this is a full-fledged Google Assistant, yet the webhook only crafts a message like âbroadcast [MESSAGE]â for now.
There could be more webhooks to expose other text-based commands youâd want to send to your Google Home. Like âSet an alarm for [ALARM TIME]â, or maybe even just an API endpoint that takes whatever text you give it and uses that as the entire message to Google.
Also, if you tell a Google Assistant something like âBroadcast time for dinner to the living room speakerâ then it would only play on that particular Google Home. So, there could be way more options, but this suits my needs for now.
If others wanted to PR my repo, it could get built out to be pretty fully-functional.
Have setup as coded for now and all working thanks. Will play around with this when I have time. A really simple change to make this more flexible would be to just remove the âbroadcastâ intro to the text request which would then allow a completely flexible google assistant request to be made.
Cool. I got this working. I published a container (Docker) using your instructions. The requirement is that the client.json needs to be added to the host folder for it to work so that the container wouldnât include my credentials.
I would LOVE for the message to be more generic so you could use it as you stated. Something like:
âBroadcast âIts time for dinnerâ on bedroom speakerâ or âSet a timer for 5 minutes for stoveâ
Then you can simply add the component input_text.intercom_message to some group. When you type something and press enter, it will play the message and then clear it from the input box.
Thanks for the feedback! Iâll definitely add a generic webhook for simply passing through the entire message. I like to keep the broadcast_message webhook though because it makes setting up the notify component a lot easier.
Iâll let you know when Iâve added that functionality, and Iâll push up a new version.
Yeah, so it must be some kind of configuration issue with the script or automation for it. Unfortunately I typed that all out from memory, so there might be something off with it somewhere.
If it works by going to it manually, then it will definitely work if the script and automation are done correctly.