Friday, September 22, 2023
Google search engine
HomeSmart HomeStart Home Automation using IFTTT and Node Red

Start Home Automation using IFTTT and Node Red

These days, a popular misconception of smart homes has come to float around. Many people these days are associating ‘Smart Homes’ with ‘voice-control’ and consider a house smart if it can respond to their commands. If Alexa can turn on the AC or the TV in your room when you tell it to do so, it is supposed to be Home Automation (HA). 

This is the wrong definition of Smart Homes. Smart Homes aren’t just supposed to react when you tell it to, rather they are supposed to do tasks without having to be asked. A good example of this is that through Internet of Things (IoT), the sensors recognize when you enter the home and automatically set temperatures and lighting to suit your need. This is Actual Automation! This involves:

  • Automatically adjusting the lighting (both indoors and outdoors) according to the conditions, as per required.
  • Activating Security Cameras.
  • Triggering the motion sensor on the pavement (to recognize any movements outside the building)
  • Autosensing whether doors and windows are closed/open and acting upon them whenever the owner is/is not around.
  • Automating the water heater at specified times (i.e., say 7 AM)
  • Automatically setting Alarms once you suggest a repetitive schedule
  • Following a Holiday Schedule whenever you’re on a vacation
  • Setting up a list of kitchen requirements if it senses your stock going empty

Home automation is taking centre-stage. Automated homes that simplify lives are being the focus of many smart product companies which are building devices that can be connected to the internet and interact with each other. Internet of Things (IoT) is going to be the future of smart homes, and there are many effective solutions for one to make an automated smart home with just a simple setup. 

Most projects online use Google Home Mini as the Home Automation Software (via Google Assistant). While this does reduce most of our work, the problem here is that if your internet crashes, your entire smart home may be rendered useless. Even though these days many assistants can run commands offline, it isn’t the entire roster of commands, hence your home may still not function as you would like it to. This is not a solution we want, and we need our Smart Home to operate under any condition. Hence, we are suggesting you a setup in which you do not need to set up via Google Homes, and you just need to use Node-RED as your Interface and IFTTT

Components used

The following components are used for our setup:

Software Used:


  1. Setting up the IFTTT Action
  2. Before we proceed any further, we need to set up an account on IFTTT. This can be done by clicking on ‘Sign Up’ tab on the home page, after which, it will redirect you to the necessary sign-up options – namely Google and Facebook. There is also an option of using an email-password configuration for your login setup. 
  3. Once done, go to the Home page of your IFTTT webpage by clicking on your ‘account’, which will appear on the top right of the web page. There are many additional features that are available on the website, however in our demo, we are sticking with the free version. Should you choose to upgrade, you are free to do so. It should look like this:

3. Good job! Now we need to ‘create’ an action, hence click on the ‘Create’ menu that you can see on the top right. You will now be taken to the create menu, which will give you the menu for the action setup. As you can see, it is pretty straightforward and easy to use:

4. So, let us first set up the trigger for our action. Click on the ‘Add’ button here and it takes you to the menu of services and applets. We shall show you how to make use of the webhook service, which is essential for this setup. There are many different services provided to you, and we do recommend that you check them out later. For now, search ‘webhook’ in the search bar, and when you find it, it should look like this:

5. Once you click on this, you will be taken to the menu where the available trigger is shown to you. Hence, you can check the trigger and its description, and then click on the displayed trigger so that we move ahead with out setup. It should look like this:

6. Once you click on the trigger, you shall see the ‘connect’ button which should look like this:

7. Once you click on connect, a pop-up window will come for a short while to check system and network conditions, which is done by the website. After that is done, you shall be redirected to the following window:

8. Now we have our Trigger set up! So now we can move on to creating the action for our trigger. You can see a ‘+’ button in between the two menus. If you click on this, you can add additional queries and get access to the filter code, with the option of adding additional applets as well! We shall not do so in this build. After ‘This’, click on the ‘add’ in ‘That’:

9. We will be making use of the ‘Notifications’ service for this tutorial. This basically sends a notification to the IFTTT app every time our event is triggered. So now you should see a similar menu as before, with all the options displayed below, which you can scroll to explore or simply search in the search bar. Since it is easier to do so, search ‘notifications’ in the search bar:

10. So, once you click on ‘notifications’, you will see the list of actions available to you. Since we just want it to send a simple notification back to the IFTTT app, we shall choose the option that says, “Send a notification from the IFTTT app”:

11. Click on connect:

12. Again, a pop-up window will briefly appear for checking your previous settings, connectivity and system. Now once you’re done with these fields, you should be taken to a menu which will look like the given image. The descriptions for the actions and how to do so are already mentioned on the website, so it is simple to use. Take a moment to appreciate how easy it is to use the website with its minimalistic UI:

13. Now we need to enter the message that will be displayed as our notification. In our case, we are just going to enter a simple message – “Motion was detected by the Raspberry Pi”. You can also add Values to the message by using the syntax {{Value1}}, {{Value2}} or {{Value3}} in the message, but this is not something we shall touch upon in this tutorial. Once your message has been entered, the screen should look something like this:

14. Click on ‘Create Action’ After this, click on ‘Continue’ and then ‘Finish’, which is a pre-confirmation page . Upon doing so, you will now be taken to the main menu which will have your options ready and displayed, which means that we have set up our IFTTT interface and webhook services. There is a ‘+’ button below here as well (as seen in the 1st image), and upon doing so, you can create multiple applets and also get access to many other actions, should you choose to upgrade to the pro-version. We recommend doing so in future cases as one flow structure for all the apps will make it easier for setting up future services. However, in our demonstration, we shall not do so since we want to show you how to set up one action! Check if your screen looks the same:

15. Good job! Now we have set up the trigger-action pair for our event! For the next step, we now need to find the necessary APIs for our build. So, now that you have reached your home page for your applets, click on your user icon, and then on ‘my services’. Next click on the ‘webhooks’ tab and then you will be taken to the next screen. It should look something like this:

16. Next, click on ‘Documentation’. You will be taken to the API page, and for security purposes, we have hidden the key and the necessary URL. You should be able to see yours in the same page, although we advise you to be a little discreet about it. You can also test your link by the ‘Test it’ button located in the bottom. Any errors are returned as JSON values, and so are optional methods for triggering an event:

Great! Now we have completed the first part of our build. Let’s move on to the second part!

2. Preparing interaction of IFTTT webhook with Raspberry Pi

In the next section, we shall tutor you on how to interact with your newly created webhook from your Pi.

1) Updating Raspberry Pi

First, we need to make sure that we are running the latest Software and download any additional packages, for which we must update and upgrade our Raspberry Pi. Enter the following two commands in the Shell:

sudo apt update
sudo apt upgrade

2. Installing Python3

Now that our packages are up to date, we can install Python3 and some of its modules which we depend on. Python is the language used for interacting with our IFTTT webhook. Hence, we shall enter the following command in the shell to sudo install Python:

sudo apt install python3 python3-pip

3. Getting access to the Python Requests Library

Finally, we must need access to the Requests Library for additional support. We shall use pip to install our module, and enter the following command:

sudo pip3 install requests

With this, now you can make your Raspberry Pi interact with your webhook. The second part of our build is now complete!

3. Using Raspberry Pi to interact with IFTTT webhook

Now comes the fun part, where we shall code how the two can interact with each other. 

  1. Showing the Pi how to use IFTTT

This line of code shall teach your Raspberry Pi the very basics of how to use the IFTTT webhook. This is essential for later part, wherein we shall introduce further steps:

nano ~/

2. Importing ‘requests’ Library

We’ll now import the requests library that we downloaded earlier onto our Pi, by entering the following command:

import requests

3. Making a ‘request’ or ‘trigger’

Now to set up the request, we will need two things. First is the ‘event name’ which we created in our webhook – which had the name “motion_detected”. Second is the webhook API key that we copied earlier. Check previous steps in this guide for more details. 

With both of these things in hand, we can now enter the following command to make the request. Remember to replace “[EVENT_NAME]” and “[YOURAPIKEY]” with your event name and your API key, respectively.‘[EVENT_NAME]/with/key/[YOURAPIKEY])

4. Saving the file

Save this file by pressing CTRL+X,Y and then followed by ENTER.

5. Installing IFTTT application on your mobile

Now you need to install the application for receiving notifications from the triggers. This is a convenient way to check out the notifications and connectivity of your application, if not you can always check on your PC computer.

Here are the following links for downloading:

6. Testing the IFTTT App

You can test the script by running the command below (with the IFTTT app installed):

python3 ~/

You should get a proper notification from the IFTTT app when this is successfully completed.

This now concludes our tutorial, which tells you how a notification will be sent whenever a motion is detected by your raspberry Pi. This is a true example of home automation, as now you aren’t giving a voice command yet you’re receiving a notification every time a motion is detected by the Pi. 

Furthermore, there are a few more Home Automation Automations that we recommend you try:

  1. Integrate Phillips Hue HUB with Hassio.
  2. Control Roku, Android and any other smart-tv with HA.
  3. Building your own Amazon Echo with Raspberry Pi.
  4. Building a Homemade Nest Thermostat
  5. Building a Homemade Ring Video Doorbell
  6. Automating your window blinds 
  7. Installing a media server integrated with HA
  8. Automated Pet Feeder
  9. Automating for visually challenged people by using sensors at appropriate places.
  10. Task Scheduling


Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments