Overview

Skill Level: Beginner

Bluemix, Node-Red, ,IFTTT, WatsonIoT, Google Home , MQTT, Javascript, RaspberryPI

This recipe shows how to integrate Google Home via IFTTT with Watson IoT Platform to control smart home (really any) device. We use a ble candle and Raspberry Pi to demonstrate how you can control a device via Google Home and IFTTT (If this than that).

Ingredients

GoogleHome
Google Account
BluemixAccount
Node-RED and WIoTP – use the Bluemix IoT starter app
IFTTTAccount
Device connect to WIoTP like PlayBlub or TJBot

 

Step-by-step

  1. The Scenario

    I used the PlayBlub as my smart device form my previous recipe (PlayBulb) you can use any device which you have setup via mqtt to Watson IoT Platform for this scenario. Here is our scenario for this tutorial:

    Screenshot-2017-04-18-08.53.56

    Basically we say a trigger command to Google Home like: “Hey Google,  set candle to red” than the Google Assitenat Chanel within IFTTT will raise an event and trigger an action to post a message to our Node-Red instance (http endpoint like http://yournodered.mypluemix.net/iftttgh). In Node-Red we pickup the message parse it and send a mqtt message (command) via WIoT to our gateway (Raspberry Pi or a NoteBook). The Pi receives the command and changes the color of our candle to red (in my case via bluetooth low engery commands). Lets go through the setup steps for the scenario.

  2. IFTTT Maker Channel setup

    Assuming you have Google Home setup and running. The next thing we have to do is to setup our IFTTT maker channel (https://ifttt.com/maker), so we can post to an url (http endpoint in Node-Red). Login/signup for IFTTT search for the maker and enable it.

    Screenshot-2017-04-18-10.45.09

     

  3. Connect Google Home with IFTTT

    Next step is to connect IFTTT Google Assistant channel with your Google Home device – it will link the channel via oAuth to your IFTTT/Google Home account.

    Screenshot-2017-04-18-10.47.46

  4. Create a http endpoint

    In order to receive notification from IFTTT we need to create a http endpoint in Node-Red so we can receive a post. I created http end point called http://yournoderedapp.mybluemix.net/iftttgh . You can find my Node-Red flow for Google Home here.

    Screenshot-2017-04-18-11.01.37

     

  5. Create a recipe in IFTTT

    Go to IFTTT and create a recipe starting with Google Assistant (Say a phrase with a text ingredient) add your phrase like “If You say “Set Candle to $”.  Where $ represnet the text/color. Note: Google Assitant lets pass Text and Number as well there a different tigger options. I just used (Say a phrase with a text ingredient). Save the trigger and add the Maker web request. For the Maker web request add your http endpoint like http://yourapp.mybluemix.net/iftttgh , i use method post, Content Type plain text and the following message in the body {{CreatedAt}} {{TextField}} it wil translater to  “payload: ” red” ,req: object, res: object” where payload will contain the text/word/color for the action.

    Screenshot-2017-04-18-08.54.31

     

    Once saved you should be able to receive a message in Node-Red when you say “Hey Google, set candle to red” based on the node-red flow form here.

  6. References

    Presentation

    PlayBulb recipe

    YouTube

    Node-Red flow

2 comments on"Using Google Home, IFTTT and Watson IoT Platform"

  1. Hi Markus,

    Very nice recipe.
    Just a quick question.
    Is the IFTTT HTTP entry point in node-red somehow protected against unauthorized access ? Or does anyone knowing the http link can set the light of the bulb ?

    kr
    Jan.

  2. Hello Jan
    to keep it simple i did not add authentication. If you like to add authentication you can use the package
    https://github.com/endemecio02/node-red-contrib-httpauth and add it to the Node-RED.
    Hope that helps …. Cheers …Markus

Join The Discussion