-
Notifications
You must be signed in to change notification settings - Fork 1
Google Home
Google Home is not IOT-friendly. Nuff said. There are many tutorials in the Internet on how to command ESP from Google Home — all awkward hacks involving multiple clouds — but here we need an opposite direction: send mailbox event to Google Home. There is no way to do this directly from ESP, but we have a nice piece of code to help us: Assistant Relay. Basically, what it does is sending phrases to Google Home, as if they were pronounced ("broadcasted") by you. The side effect is that Home always prepends your name to the message, like "It's from Denis: mailbox one opened". Well, whatever...
Assistant Relay is a NodeJS package, meaning it has to run on some "real" computer in the same network where your Google Home sits. For unattended 24x7 use, Raspberry Pi looks like a good candidate. I had it installed on Raspberry Pi 4B with Raspbian 10. Follow the "Getting Started" manual on Assistant Relay website to set it up (this is quite a process by itself, I must say). Once you have it answering your "Sandbox" messages, you are all set to hook it up to Mailbox. Edit GoogleAssistant.cpp
to point it to your installation of Assistant Relay:
const char *GoogleAssistant::url PROGMEM = "http://192.168.1.2:3000/assistant";
One thing I did not find in the Assistant Relay package is an autostart feature, which is absolutely crucial to for this kind of application. So I made my own startup file assistant-relay.service
:
[Unit]
Description=Google Assistant Relay Server
After=network.target
[Service]
WorkingDirectory=/usr/local/src/assistant-relay/latest
ExecStart=npm run start
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=assistant-relay
User=root
Group=root
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
You need to edit the WorkingDirectory
line to point it to the location of you installation. This file is equally available in assistant-relay folder of this project. Once the file is created, auto-start can be enabled as follows:
$ sudo cp assistant-relay.service /etc/systemd/system
$ sudo systemctl enable assistant-relay