0

IFTTT for the Fibaro HC2 – this is how it works

by crissxcross22. September 2016

Everything is possible now! In this tutorial I am going to show you how to address the IFTTT with your Fibaro and also, how to use IFTTT as a trigger. In the given example, we are going to switch the Belkin WeMo devices.

IFTTT should be a term for many of you. It is a free-of-cost web service, which provides so called “Channels” and recipes. The channels on the other hand can be web services such as: Google Mail, Office 365, eBay, Yahoo Weather, Soundcloud, RSS Feeds and so on… However an IoT (Internet of Things) Device, which is a device that can communicate with the internet independently, can also be a channel. For instance the netatmo weather station, Wink Smart Home products, SmartThings, Philips Hue lights, Google Nest thermostat and smoke sensor, Belkin WeMo, Switch, LED lights and of course Blink (1) :-) but more about that another time.

IFTTT thereby stands for “IF-THIS-THEN-THAT”. It is a very simple rule, but when performed, it connects devices and services of all kinds of manufacturers. This way one could say:

  • When the WeMo Motion Sensor detects motion, Then send me an eMail via Google Mail
  • When new articles appear in the eBay search results, Then turn the Philips Hue on red
  • When the Netatmo outside temperature is < 0° C, Then turn the nest thermostat on

There is actually a lot possible here. Would it not be great, if it was possible that when one pressed a Z-Wave wall-switch, the WeMo LEDs then turned on, or the WeMo Switch? When the Fibaro Motion detects motion, then it sends a message to the Android Watch, or when somebody calls you on your Android Phone, then TV or music are turned down via Fibaro Virtual Device.

I have so many ideas. It is really cool that this is now possible!! :-D

As of recently there is a new channel called “Maker” – it is able to:

  1. Act as a Trigger, it then invokes a http order
  2. Accept http orders and perform actions

This means with Fibaro we are able to communicate in both sides with IFTTT. This way you can now start a scene on Fibaro if Yahoo Weather reports rain, or you have a new eMail or an event in your Google Calendar is about to start, or whenever you leave resp. reach a defined area with your iPhone, or when the Fitbit bracelet reports that you are sleeping…

The other way around you can also fire off an HTTP order, which turns the WeMo Switch, the WeMo LEDs, the Philips Hue, the Google nest thermostat, blink(1) ;-) on/off, controls or sends an email resp. push notification, sets an entry in your calendar or an Evernote Event and so on…

A lot is possible! – And this is how it works!

Setting up the IFTTT Maker

I am just going to assume that you already have an IFTTT Account, if not simply register on here. If you are logged into your account, go to channels in the top of your menu and look for “Maker” – and then add it. Thus you automatically receive a “secret key”. You will need this one later, when we want to trigger a call via http in the direction of the IFTTT actions.

IFTTT Channel Maker – can be controlled via http order

IFTTT Channel Maker – can be controlled via http order

IFTTT starts a scene on your Fibaro

I do not want to explain the following part as detailed. This is not because it is not as interesting – if anything, this part is highly fascinating! It for instance allows us to use the location of our iPhone to trigger scenes or switch devices directly. Even though the Fibaro App comes with the geolocation function as well, that one is based on GPS and sponges up your battery power really quick. The IFTTT solution on the other hand works via: mobile communications-, Wi-Fi and GPS-network, which is much easier on the battery. Additionally we can also trigger a scene, whenever an event in our Google Calendar is coming up and much more.

The channel “Maker” calls up an http order. Above that every single device can be controlled in the Fibaro. The http order will then look like this:

What you need in this case is a DynDns account (there are many providers like DynDns, noIP.com, selfhost, and so on), because you are going to receive a new IP address from your provider every 24h. Though, the “Maker” Channel on IFTTT is in need of a permanent address in order to reach your Fibaro. This is why you need the DynDns account. You can deposit the access data in your router under the respective menu item. Every time your router receives a new IP from your provider, it directly registers it to the DynDns account. It deposits the IP and maps it to your DynDns address, which there is: http://youradress.dyndns.org.

Your router will therefore always be accessible over this domain. In order to get your Fibaro to answer on Port 80 (Web application), you need to forward this Port to your Fibaro. Please be aware though, that by doing this you put a potential door to your Fibaro on the web. Orders that are transmitted via http are unencrypted and could be read along.

Create a recipe

Now when your Fibaro can be accessed via Domain / DynDns from the outside, you can apply a recipe. These are the When-Then-Terms of the IFTTT. To do so you have to log back into your IFTTT account and then go to “My Recipes” -> “Create Recipe” in the horizontal menu in the top.

At first you have to choose the trigger, which is the term. This can be the change of your location or when you receive a mail resp. a mail from a certain person (boss? ;-p) or when rain is detected and so on. Tip: Which trigger is provided by a channel can already be seen before associating the channel, by going to “Channels” and then clicking a random channel. If you are this far, scroll down a little and you will find all available triggers on the left side and all available actions on the right.

Maker Channel IFTTT

IF this -> choose Trigger

You now have to look for the “Maker” in the THAT order and choose the only available action “make a web request”. Now, type the order that switches your device resp. starts your scene into the URL. I do not want to get into detail at this point, because these API Calls for Fibaro have already been used by Daniel for his voice control via Google Now with Tasker. This is why I simply want to set the link with the remark that you have to adopt the links 1:1, only the IP address has to be replaced by your DynDns Domain. Ahead you put your username and password:

Example:

It makes more sense to control a scene than just addressing a single device via http, because if necessary you can simply change or complement the scene on your Fibaro. Otherwise you can address a single device as shown below:

Something else that might be interesting are virtual modules, they are controlled like that:

Anything else can be read in Daniels’ article :-)

Triggering an IFTTT action

As described, we can also send an http order via Fibaro, which then triggers an IFTTT recipe. This means we could turn on the WeMO LEDs, the Philips Hue or the WeMo Switch via keystroke on a remote, such as KFOB or a wall switch. We are also able to set the WeMo LEDs into the “Sleep fader” (slowly dimming down) time controlled, via scene. Alternatively a push notification can be send to the iOS notification center, or an email in case of motion.

There are two possibilities to send this http order. Either:

  1. via Button on a virtual device
  2. via Scene

Both ways have their advantages and respective application possibilities:

  1. I would always use the virtual device for hardware devices, if I want to control e.g. the Philips Hue, Google nest, blink (1) :-D, WeMo Swtich, LEDs or the WeMo Maker. The buttons of the virtual device can also be pushed in “Scenes”.
  2. A scene is qualified for the controlling of web services via IFTTT. This way you can for instance send an email via Google Mail or a message to the iOS Notification Center. Values, which will later be the content of the email or push notification, resp. the value to which a lamp is supposed to be dimmed and so on, can individually be filled in the scene.

We are going to take a look at both possibilities:

IFTTT as a virtual device in Fibaro

In this example I want to quickly show you how to control a WeMo Switch (outlet) via Fibaro. We already connected the Maker-Channel with our IFTTT Channel earlier and thereby received our secret Key. Next up we are going to need the name of the event. For this purpose you need to go to “My Recipes” in the IFTTT Channel and then to “Create a Recipe”. You now have to choose the “Maker” channel as trigger in the “IF THEN” part. At this point you only have one choice again: “Receive a web request”.

You now have to assign a name to your event. This can be done based on your imagination. It will later serve to clearly address the recipe via http order. With a click on “Create Trigger” you will get to the “THAT” part, in which the action will be determined.

THAT: From all channels you are now able to choose one action, which you want to be performed when the Maker was triggered via http order. As already described, we want to control the WeMo Switch. You therefore have to look for “WeMo” and choose the channel from the switch.

All possible actions will now be shown. Next to turning the outlet on and off, we can also “toggle” it, which means switch it into the “Opposite Status”. This actually is what I choose, because this way, I am able to turn the outlet on/ and off via a virtual button.

In the next step you will have to choose, which of your WeMo Switchs you want to be controlled. This has to be done via DropDown. Afterwards the button “create Action” will apply the “Recipe”.

Creating a virtual device

We now do not have to do anything but send the http order, which includes our event name and the secure key. How it is supposed to be built can be found in the channel “Maker” with a click on “How to trigger Events”.

So first of all switch to the web surface of Fibaro, then go to Modules -> then on the left to “Remove or add device” -> and once you are there choose: “virtual device”. Assign a matching name to it and switch to the tab: “Extended”. On there you have to add a button. Shift it from “character string” to “LUA”. The script will look as follows:

Both needed variables are familiar: {event}, as well as {Userkey}. The Userkey is the “secret key”, which you received when adding the “Maker” Channel – the event has just been applied and was named freely. You now insert these variables into the link (without the curly brackets -> {}). It will look as follows:

You now only have to save everything and then you are done. Time for a test. Via click on the button the WeMo outlet should be turned on, resp. off. You should be able to see a respective log entry in the IFTTT, when clicking “Recipe” and then “Log” on the left.

IFTTT in a scene

Fibaro Scene – IFTTT

Fibaro Scene – IFTTT

Here, too, you only need to replace the two variables “event name” and the “secret key” respectively.

This is how easy the Fibaro can be connected with the IFTTT and thereby extends the possibilities enormously. I am excited to see what you are going to use it for, tell me about it in the comments.

About The Author
crissxcross
Hi, I'm crissxcross, qualified IT system electronics. Professionally, I work as a product marketing manager in the Smart Home. And private I am self a Smart Homie :-) If I do not sit in front of the monitor like I photograph and am a big fan of Apple. I am the founder of the SiiO.de blog.

Leave a Response