Google Assistant Webserver in a Docker container

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

Thanks! Gonna try that!

Ok, after reading this, what’s actually the difference between TTS and this? With TTS you can also send voice commands

The difference is the voice engine. This webserver uses the Google broadcast feature to send TTS, which sounds far more natural than the HA TTS.

I stopped using it though since google added ‘broadcast by…’ to every message you send using the broadcast feature.

Ok, thx for sharing

The other big difference is that broadcasting dips the volume of any current media and speaks over it whereas TTS causes currently playing media to stop. Also, broadcast shows the text on the screen of any smart displays with is a nice touch. In my setup I have a Google account specifically for Home Automation stuff, so the name on the account is “Home Assistant”. When I send a broadcast using gawebserver I get “Incoming broadcast from Home Assistant:…” which I actually like better than it just abruptly starting to talk because it gives you a second to shift your focus to listening and you don’t miss the beginning of the message if people are talking, etc.

1 Like

ok, gonna play also with this now :slight_smile:

I tried everything like you said:

This is what I get when I hit deploy:
Failure

error while creating mount source path '/usr/share/hassio/share/gawebserver/config': mkdir /usr/share/hassio: read-only file system

What did I do wrong?

well i also use hassio, (on hassos)
i also got the same error, so the host (my hassio) the config folder was for example :

/mnt/data/supervisor/homeassistant/

@pergola.fabio it’s not clear does /mnt/data/supervisor/homeassistant/ work on hassos or do you get the read-only error.

@capstan1 I don’t use hassos so sorry can’t be more help. you’d need a place on the filesystem you can access and put the client.json, and also store the temp files.