Raspberry Pi Home Automation with Google Assistant integration — Part 3 (Assistant integration)

Sidhant Panda
2 min readNov 2, 2018

--

Part 1: Raspberry Pi Home Automation with Google Assistant integration — Part 1 (Software)

Part 2: Raspberry Pi Home Automation with Google Assistant integration — Part 2 (Hardware)

So up till now you have been able to control the switches with the React based frontend. Time to take things up a little notch. We’ll be integrating Google Assistant to control the services on our Raspberry Pi.

We’ll use IFTTT to setup our trigger statement and have it make an API call to the NodeJS server exposed via ngrok to the world

We’ll run ngrok inside a tmux or screen shell as the URL generated for the device changes on every load.

Install tmux

$ sudo apt-get install tmux
$ tmux new -s ngrok

Download the latest ngrok (ARM64 version). Ngrok version at the time of writing this was at https://bin.equinox.io/a/nmkK3DkqZEB/ngrok-2.2.8-linux-arm64.zip

$ unzip /path/to/ngrok.zip
$ ./ngrok authtoken <YOUR_AUTH_TOKEN>
$ ./ngrok http 80

Take a note of the external HTTPS url generated by ngrok. Now you can detach from tmux by ctrl + bfollowed by d.

Create IFTTT trigger

Head over to https://ifttt.com/ and sign in /sign up.

Next , authenticate the Google Assistant service with your Google account which you use on your phone or Google Assistant enabled speaker or device.

Once that is done, go the Create Applet and then select Google Assistant service. Select the “Say a simple phrase” trigger.

Next, choose the “Webhook” action service and the “Make a web request” action.

And save the trigger.

And you’re all set! You’ve successfully set up Google Assistant to control your Raspberry Pi and the attached relay module.

Here’s my setup:

--

--