Skip to content

Google Home

Denis Stepanov edited this page Mar 2, 2023 · 11 revisions

Google Home Interface

Google Home Interface

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 format (introduction) of broadcast is defined by Google and cannot be changed. 2023 example: "Incoming broadcast. It says: mailbox one opened".

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.

Local module and a Pi

(receiver module talks to Pi over Wi-Fi, so they are not required to be next to each other. On this pic we take advantage of Pi presence to power the receiver module from it and spare one power supply)

Follow the Getting Started manual on Assistant Relay website to set it up (this is quite a process by itself, I must say).

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

To test the setup you can access link http://IP:3000, where IP is the IP-address of your Raspberry Pi running the service. In there, you can run some test messages from Sandbox interface. Once you have it answering your messages, you are all set to hook it up to Mailbox. Open the mailbox website http://mailbox.local and go to the Conf section:

Mailbox Global Configuration

Enter the full path to the Google Assistant service in the form of http://IP:3000/assistant. You can click the Test button to send a test message from Mailbox. Make sure that you checked on the service and click Save.

Clone this wiki locally