Home Assistant Community

Google Assistant Webserver in a Docker container

docker
googleassistant
Tags: #<Tag:0x00007fcf5164e740> #<Tag:0x00007fcf5164e5d8>
#10

If anyone knows how to do this, could be very beneficial to the project.

#11

Sometimes I’ve got thir error :
UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\xe9’ in position 42: ordinal not in range(128) stderr
On a Synology nas. Any idea?

How to say to play music with a timer? Thanks !

commands work, but broadcasting no. It was working fine with andbobsyouruncle-amd64-google-assistant-webserver. Is it playing only on soundcard?

#12

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

#13

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.

#14

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?

#15

@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.

#16

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.

#17

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
#18

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?

#19

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:)

HA to trigger Alexa routine
#20

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

#21

Yes, I’ve passed the same.

1 Like
#22

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

#23

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.

#24

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.

#26

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
#27

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.

#28

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).

#29

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:

#30

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