Use WPLight with IFTTT

An example on how to integrate your WPLight with If This Then That platform

The WPLight can also be used with IFTTT, without WordPress. Normally it works with WordPress, it calls your WordPress site to get data from the WordPress IoT plugin:

The plugin answer with a simple message, with number, mode, timer. You can read everything about how it works in the WPLight API page.

If you want to use the WPLight with IFTTT you can try something like this, using an external free IoT service like Thingspeak.com to store the string command to send to the WPLight:

 

In this configuration we use IFTTT to check if we have new emails on our Gmail account, if we have then we trigger the Maker channel to call Thinkspeak service to store the blink command for the WPLight.

The WPLight keep calling the Thingspeak service to retrieve the last value stored.

In IFTTT we create also 2 buttons, one to turn the WPLight on and one to turn it off.

What do you need:

  1. WPLight :-)
  2. Ifttt.com account
  3. Thingspeak.com account

Thinkspeak configuration for WPLight

Sign up for an account on Thingspeak.com and create your channel.

You will get a channel ID.

In a Thingspeak channel you can store data coming from HTTP calls. Channels can receive up to 8 parameters. We need just one for WPLight.

Configure the channel with 1 field, like this:

In the API Keys tab you can get the security API keys to use for read and write on your channel.

Uncheck this flag to make your channel private:

To store data in your channel you can use the write API key and make an http call like this:

https://api.thingspeak.com/update?api_key=YOURAPIKEYWRITE&field1={0,D,10}

This will store the command {0,D,10} in the field1

To retrieve the last value stored, make this call:

http://api.thingspeak.com/channels/22XXXX/fields/1/last.txt?api_key=YOURAPIKEYREAD

So, this last URL must also be inserted in the WPLight configuration panel in the Url field.

(It’s quite long, so probably you have to cut and paste in a mail and send it to your phone)

IFTTT configuration for WPLight

In IFTTT activate the Maker service. You will get API keys to make HTTP calls.

Create an IFTTT Applet, and choose the Gmail service (you have to configure it if it is the first time) then choose to trigger if “Any new email in inbox”.

Choose the action Maker and make a web request, fill the fields to perform the call to Thingspeak service. The call stores in Thingspeak the value {5,C,120} which means blink at medium speed for 120 seconds:

The IFTTT applet will be something like this:

Since you’ve configured the WPLight to call the url:

http://api.thingspeak.com/channels/22XXXX/fields/1/last.txt?api_key=YOURAPIKEYREAD

The WPLight keeps calling and when new mails come, IFTTT write {5,C,120} and the WPLight blinks!
There can be some delay, since IFTTT has delays, and the WPLight calls are also delayed.

To turn the blinks off we need to make another IFTTT applet using the “Button widget” that can be used to trigger actions manually, from your phone or from PC.

Choose “Button widget” from the services, and “Button press” as the action, then use the Maker channel to perform another call to Thingspeak and store the command {0,D,10} to turn the light off. Call this applet “WPLight off”.

Make another applet to store the command {1,D,10} and call this applet “WPLight on”.

As you can see in the ON/OFF command I’ve put a timer of just 10 seconds to turn the light on or off fastly.

That’s all.