Google Assistant Webserver in a Docker container

\xe9 is a small letter E with an acute accent mark. Try replacing it with a regular e.

Yes I know, I’m french and this characters are regularly employed. I don’t undersand why it does’nt work, while it work with andbobsyouruncle on the same platform.

Thanks for your help.

You’re definitely right.
Sorry for the noob question: I’m very new to home assistant and am using Hass.io. I only installed new things using the hassio plugins.

Can I install this in hassio? If yes: will it discover the USB soundcard?

@capstan1 This project is not made to work with Hass.io. Personally I use Docker so this was easy to just share with others to use. The only solution for Hass.io right now is AndBobsYourUncle’s however it cannot cast remote media (spotify). Anyone is welcome to take what I / we’ve done and make it an add-in for Hass.io.

I don’t need streaming necessarily (would be a great addition to have though). My problem with the hassio plugin is only that broadcasting isn’t working for me, so I wanted to try your solution.

For me it works without real soundcard enabled, using:
sudo modprobe snd-dummy

I’m able to use it and play music on selected device. Many thanks for great work.

3 Likes

Does this solution also suffer from the issue with the google home saying “incoming broadcast from x” or have you somehow been able to get around it?

It has the same issue, we cannot disable that as long as Google doesn’t provide an option.

My Google Home is setup in french and didn’t have this issue at first, but Google recently rolled out an update in France that’s also changed the behavior of broadcasted messages. (For once I was glad updates were late :sweat_smile:)

Using sudo modprobe snd-dummy what devices do you pass into the Docker container. Same that I do? /dev/snd:/dev/snd:rwm

Yes, I’ve passed the same.

1 Like

This looks very interesting, as I assume this Webserver can run my Google Home Routines? (Which the Hassio version of Google Assistant Webserver does not when I tested).

A few dummy questions though…

Currently Im running HA on Raspberry Pi 3 B+ with Hassio only. Besides this Raspberry Pi and a Windows 10 PC, I dont have any other Linux setup or server. Im not familiar with Docker containers either (sorry for being a newbie), and I wonder if (and how) I can make this to work on my current Raspberry with Hassio, or my Windows 10 PC which is on 24/7 here at home?

Can I install a Docker container on any of these, or should I buy another Raspberry Pi for this purpose?

All I really need this for, is to call my Google Home Routines through buttons/cards in Home Assistant. Or at least be able to call functions like “play spotify on living room speaker” with HA/Lovelace card, which doesnt work with the Hassio version of Google Assistant Webserver.

Thank you

From what I’ve herd Docker on Windows doesn’t work the best yet and is not compatible with Linux based containers. If you don’t have a Docker environment (I have a Docker getting started tutorial here) then your best bet is to run though the Embed the Google Assistant tutorial from Google and run the python script they provide on your Raspberry Pi or another computer.

If you’re running Hass.io then you’re technically already running a Docker environment. Using the Portainer addon you can add any Docker containers you want.

I was able to hack together a working local addon, but noticed it dies after using it to start a cast on another device. I went back and deployed on docker to confirm, and it does the same thing, the difference is the docker setting to restart on failures.

  • is this expected behavior - container dies and has to be restarted after requests?

To get it to work as a local addon I ended up hard coding the variable in the scripts and repointing the folder to the \share map in hassio. I’m sure someone with a little more knowledge with addons could convert this over pretty quickly. I may keep working on it but it’s only second time I’ve done anything with addons and the first was pretty simple.

1 Like

I don’t have any experience with hassio addons personally. If someone would like to convert this project to an hassio addon or suggest changes to the container to make it more compatible, I welcome it.

So did anyone got this to run in Hassio?

If yes, can we get detailed instructions how to build this using portainer. I’m just lost and have no idea where to start.

I got myself a cheap USB Soundcard for my Raspberry Pi which is working out of the box, so hardware-wise I should be ready to go.
Sorry for these noob question, but I just never used docker (I know that I did, but only with Hassio - no tweaking).

these are the settings in Portainer:

For the Volumes be sure to map to hassio config directories. maybe look at what some other addons volume’s map (change the portainer config in the hassio section to not hide the hassio containers)

Under Env, this is where you put your Model ID and Project ID. Also match the ARCH to whatever platform you are on (for a pi for example)

I’ve found this is the key to getting this to work and also why it can’t work as a hassio addon: set the restart policy to on failure

this is where the sound devices are mapped:

I followed the steps but it seems that I missed something. I cannot surf to port 9324 and in the docker logs I’m seeing the following error

[Error] You need initialize GoogleAssistant with a client secret json!

The client secret is under the folder specified in the steps.

Edit: Just noticed that I missed a folder in the configuration

Thanks for these instructions, just found time to try this. However, I don’t know where I should create the folders
/home/$USER/docker/config/gawebserver/config and ../assistant

Never been digging into Hassio, but it seemes the “normal” folder structure with a home folder isn’t present on my SD card.
Where did you make these files?

I’m running hassio on an ubuntu box, but I think if you create the directories under your home-assistant share directory. then map the host path to /usr/share/hassio/share I think you will be okay.

Under /share in hassio create the gawebserver/config and gawebserver/assistant
then map /usr/share/hassio/share/gawebserver/config to /config
and /usr/share/hassio/share/gawebserver/assisant to /root/.config/google-assistant-library/assistant

you can see from the homeassistant container properties, that this is where the share and config folders are mapped.

1 Like