Wednesday, June 24, 2015

Controlling my Air Purifier using IFTTT Maker and my Web server

Now that IFTTT Maker was released, I will be switching away from my original method of using Dropbox for home automation requests. IFTTT Maker allows you to create IFTTT recipes that interact with a web server of your choosing. In this article I will describe how I replaced my old method in automating my air purifier with IFTTT Maker, which allows it to be faster and more reliable.

For this to work you will need a web server running on your network. I am using my Synology NAS setup for this. I made a php file called interface.php which will be used from now on to interface all my home automation projects to IFTTT. If you look at the file you can see it just executes an ssh to my Raspberry Pi which runs the script to turn on my air purifier. The only part you would need to edit is the TOKEN value, which you can set to anything random that you would like (think of it as like a password).

Now we create a new recipe on IFTTT using the IFTTT Maker channel. The parts of the web request action you need to set are:
  • URL: Point to where the interface.php file is accessible on the web.
  • METHOD: Set this to POST
  • Content Type: We will have this as application/json
  • BODY: Here is the JSON data that we will send to the php file to parse. The method I am using is:
    • {"token":"YOUR_TOKEN", "type":"purifier","action":"toggle"}

Let's break down how it works. In the BODY you are sending an array of data in JSON format which are "KEY":"VALUE" segments separated with a comma. In the PHP file, we capture this data packet using file_get_contents('php://input') and store it in the variable $input. We then access the key values like any other array using $input['key'].

I wanted to use HTTPS with IFTTT Maker so that the connection is secure. Unfortunatenly, IFTTT does not support self-signed certificates. I tweeted IFTTT about using self-signed certificates and they replied that they might add it as a feature request. So I decided to buy the Comodo Positive SSL for a few bucks to get it working.

Now you, too, can begin to use IFTTT Maker to change the way you do home automation. I am really happy that IFTTT has implemented this. Look forward to more articles on home automation with IFTTT!


  1. Congratulations on having one of the most sophisticated blogs Ive come across in some time! Its just incredible how much you can take away from something simply because of how visually beautiful it is. Youve put together a great blog space –great graphics, videos, layout. This is definitely a must-see blog! swirling water air purifier

  2. Thanks for the valuable information and insights you have so provided here.

    192.168 l 254

  3. How much does Comodo Positive SSL cost you? I really wanted to try this method too on my air purifier. Shop your next car at carvana’s apps and get amazing discount for plan protection from them. play game

  4. İnstagram takipçi satın al! İnstagram takipçi sitesi ile takipçi satın al sende sosyal medyada fenomen olmaya bir adım at. Sende hemen instagram takipçi satın almak istiyorsan tıkla:

    1- takipçi satın al

    2- takipçi satın al

    3- takipçi satın al