Run tiny web server which expose REST Api for sending broadcast text messages to your Google Assistant, by using the Google Assistant Service.
Ever wanted to broadcast a voice message to your Google Assistant enabled speakers in your home, without interrupting your music that is currently playing? Now you can, and I have tried to make it quit easy for you.
I have made this after a lot of research, and it all started with this thread on the Home Assistant forum.
I want to give credits to:
- endoplasmic/google-assistant by @endoplasmic
- AndBobsYourUncle/google-assistant-webserver by @AndBobsYourUncle
- greghesp/assistant-relay by @greghesp
-
You don't need to prefix the message with
broadcast
,shout
andtell
etc. as this is already done for you. -
According to Google Assistant doc you can broadcast to all speakers or specific speakers. I have just tested to all.
- docker - you need to have Docker installed on your machine, read Get Docker for more information.
- Google OAuth 2.0 Client ID and Access Keys - in order to authenticate yourself and get access to your Google
Assistant
- You can find help and more information at ismarslomic/google-assistant-oauth
Create folder with name config
and add files client_secret.json
and tokens.json
.
docker-compose.yml
version: '3.8'
services:
google-assistant-broadcast:
container_name: google-assistant-broadcast
image: ismarslomic/google-assistant-broadcast
restart: unless-stopped
ports:
- "8085:8085"
volumes:
- ./config:/usr/src/config
docker-compose up -d
Create folder with name config
and add files client_secret.json
and tokens.json
.
docker run -d --name google-assistant-broadcast \
-p 8085:8085 \
-v /path/to/volume/config:/usr/src/config \
--restart unless-stopped \
ismarslomic/google-assistant-broadcast:latest
You can easily integrate this REST Api in Home Assistant by using the RESTful Notifications platform.
Add following to your configuration.yaml
file:
# Google Assistant Broadcast - REST Api
notify:
- platform: rest
name: ga_broadcast
resource: http://localhost:8085/broadcast
method: POST_JSON
Broadcast the message by calling the Notification service ga_broadcast
(from previous step):
service: notify.ga_broadcast
data:
message: Hello world!!
Endpoint: POST http://localhost:8085/broadcast
Request payload:
{
"message": "Hello world!!"
}
curl -X POST http://localhost:8085/broadcast \
-d '{"message":"Hello world!!"}' \
-H "Content-Type: application/json"