Software apps and online services
Just a few days ago IFTTT launched a channel for makers. Just in case you do not know IFTTT yet, it is a web platform that facilitates connections between other big platforms under the form of recipes giving a great degree of flexibility in creating mashups.
This was a highly awaited feature since until now it was impossible to connect prototypes to the recipes and only a few approved devices were available from large producers that were accepted in the platform. The Maker channel changes all that. It allows both making web requests to the channel to send events to other platforms from devices and from other platforms to the devices.
The only problem with the channel is that it allows only HTTP requests to be made and if you get a bit unlucky with the device and it's network the command might not reach it. Protocols like MQTT are far more reliable and have a lower footprint. A special property of the protocol is that it has a quality of service which specifies for the data to be sent until the device receives it. To take advantage of this you can either host your MQTT broker or take advantage of an IoT platform that offers this. DeviceHub.net offers this service. You can learn more about it in this tutorial specific about MQTT and what benefits it has over HTTP here.
The first step is to register on the platform and create a Device as an entry point for your data on the cloud. You can do that herehttps://dashboard.devicehub.net/register and follow the wizard there to create your device.
Every Device has a unique id (UUID) and an associated API key of the project it resides to make sending data secure and reliable.
After you have one device add an Actuator in it. This will be hooked to the prototype by using the bellow code and relay the action done with the IFTTT button.
To use IFTTT you have to set up a recipe in the Do button on your phone:
We used an ESP8266 kit because it had already a relay and all we needed for a quick IoT setup. You can use any hardware with the DeviceHub.net platform as long as you set up the API requests right. All we wanted is to switch an appliance on and off with the Do button app from IFTTT.
To upload it to the ESP8266 we used the esptool utility that runs with Python.
For the main code we used ESPlorer to upload it. You can find the init.lua and project.lua files in the software zone of this tutorial.