IFTTT

 


What is IFTTT?

"If This Then That" (IFTTT) is an automation service that allows users to connect various devices and services to automate tasks.

"In 2011, our founder, Linden Tibbets, became obsessed with the study of all of the small actions we do each day to keep our lives running at peak efficiency. Coupled with his programming background, he realized that by creating little bits of code that could repeat over and over with special triggers, people could simplify many of the menial tasks that they dread. Linden likes to refer to these early automations as "digital duct tape," connecting two services together that would usually not be compatible." -  [1]

An Example of using IFTTT is to monitor every time your doorbell rings. Using IFTTT you could connect a device such as the Micro:Bit that when your doorbell is rang "THIS", then the time and date is logged in a google spreadsheet "THAT".


Using IFTTT with Micro:Bit in the lab 

To get an understanding of using IFTTT with physical devices, I decided that I would try to send an email at the press of a button. This feature is one of the most important use cases for IFTTT as it can have several applications such as sending confirmation emails upon purchase of an item, monitor equipment and sending an email if a fault occurs etc. Initially I tried to get the HRV sensor working with IFTTT and my plan was to send an email if the heart rate dropped below a certain value, however, I was having difficulty using the sensor with the cloud board (more on this later).

Instead, I opted for sending an email at the click of a button. To achieve this, I needed to download an extension called "DFRobot_IoT_Cloud_Kit" in the extensions menu.



Next, I wrote the code for the micro:bit, this code is very simple and is only three lines of code. Later I would need to fill in the IFTTT configuration strings which consists of the Applet name and the key for the Applet which I set up later.


Lastly, I created the IFTTT event. This consisted of a webhook which receives a web request (on button press) with a JSON payload. This is useful for sending a specific email i.e. if you have multiple devices running in different locations, you could send the ID of the device and a message specific to what that device is monitoring etc. I then set of the "Then" which is an email to myself. I had issues with this initially because when I was prompted with email permissions, I missed the checkbox which gives IFTTT permission to send an email on your behalf,. It was because of this, it took me much longer to get this working than it should have and I had to remove permissions in my google account and set the Applet up a second time to allow IFTTT permission to send an email.

WEBHOOK IS PAID SERVICE ONLY - unfortunately, the ability to use webhooks is only available on the Pro subscription for IFTTT. Before attempting to write any of the code, I tried to research other IFTTT-like services that would allow me to use webhooks for free, however, other services either required me to subscribe to use the webhook features or they did not have webhooks features to begin with.


On Button Press




Progressing This Use Case

As mentioned earlier, I had difficulty using the HRV sensor with the cloud board. As the cloud board is designed for wireless communication, it is limited in terms of analog input on its GPIO pins. A way to resolve this issue is to introduce a second Micro:Bit which reads the data from the HRV sensor and using the radio send function, send the data to the Micro:Bit on the cloud board, when the board receives the data, it should then use the IFTTT send value function. 

If I could continue on from this lab, it would be interesting to try to implement a second "Then" where the time and date of the button press could be logged in a google spreadsheet as well as sending an email. Adding additional services to the applet is on the Pro version of IFTTT and requires a subscription.



References

[1] - https://ifttt.com/explore/what-is-ifttt  - what is IFTTT

Comments

Popular posts from this blog

Blog 2 - HRV Demo

Week 1: HRV Review

Blog 5 - FFT & HRV