Google Assistant Webserver in a Docker container
1M+
This is a emulated Google Assistant with a webserver attached to take commands over HTTP packaged in a Docker container. The container consists of the Google Assistant SDK, python scripts that provide the Flask REST API / OAuth authentication and modifications that base it from the Google Assistant library.
I did not write this code, I simply pulled pieces and modified them to work together. AndBobsYourUncle wrote Google Assistant webserver Hassio add-on which this is largely based on. Chocomega provided the modifications that based it off the Google Assistant libraries.
How does this differ from AndBobsYourUncle's Google Assistant Webserver? This project is modified, running based on the Google Assistant libraries not the Google Assistant Service which allows for additional functionality such as remote media casting (Casting Spotify). See the table here
client_secret.json and move it to the configuration directory /home/user/docker/config/gawebserver.DEVICE_MODEL_ID and PROJECT_ID environment variables with the values from previous steps. Lastly change the volume to mount your configuration directory to /config.http://containerip:9324) where you will see Get token from google: Authentication.$ docker run -d --name=gawebserver \
--restart on-failure \
-v /home/user/docker/config/gawebserver:/config \
-p 9324:9324 \
-p 5000:5000 \
-e CLIENT_SECRET=client_secret.json \
-e DEVICE_MODEL_ID=device_model_id \
-e PROJECT_ID=project_id \
--device /dev/snd:/dev/snd:rwm \
robwolff3/ga-webserver
version: "3.4"
services:
gawebserver:
container_name: gawebserver
image: robwolff3/ga-webserver
restart: on-failure
volumes:
- /home/user/docker/config/gawebserver:/config
ports:
- 9324:9324
- 5000:5000
environment:
- CLIENT_SECRET=client_secret.json
- DEVICE_MODEL_ID=device_model_id
- PROJECT_ID=project_id
devices:
- "/dev/snd:/dev/snd:rwm"
http://containerip:5000/command?message=Play Careless Whisper by George Michael on Kitchen Stereohttp://containerip:5000/broadcast_message?message=Alexa order 500 pool noodlesNot sure why a command isn't working? See what happened in your Google Account Activity or under My Activity in the Google Assistant App.
Here is an example how I use the ga-webserver in Home Assistant to broadcast over my Google Assistants when my dishwasher has finished.
notify:
- name: ga_broadcast
platform: rest
resource: http://containerip:5000/broadcast_message
- name: ga_command
platform: rest
resource: http://containerip:5000/command
- alias: Broadcast the dishwasher has finished
initial_state: True
trigger:
- platform: state
entity_id: input_select.dishwasher_status
to: 'Off'
action:
- service: notify.ga_broadcast
data:
message: "The Dishwasher has finished."
My full Home Assistant Configuration repository.
Broadcast messages not working? You may need to set an address on the ga-webserver the same as the address's registered with your other Google Assistant devices. I the Google Assistant app go to More > Settings > Settings > Assistant. At the bottom select your ga-webserver and set the applicable address.
If it was working and then all the sudden stopped then you may need to re-authenticate. Stop the container, delete the access_token.json file from the configuration directory, repeat the First Run procedure above.
Have problems? Check the container logs: docker logs -f gawebserver
Content type
Image
Digest
Size
278.8 MB
Last updated
over 6 years ago
docker pull robwolff3/ga-webserver