ESP32 (16) – IFTTT

luca 07/05/2017 0

After having published my tutorial about sending SMS with the ESP32, I received some comments via the contact form of my website asking a way to send notifications for free. Today I’ll show you a way to do it; it will be also the occasion to write about IFTTT service and about developing custom components for the esp-idf framework.

IFTTT

IFTTT (IF This Then That) it’s a web service that allows to create applets connecting different services with the pattern if this happens, then do that action.

ifttt-12

To better understand what you can do with IFTTT, here are some pre-built applets:

  • send me an email if rain is expected tomorrow
  • automatically post on Facebook the photos I share on Instagram
  • turn on silence mode on my smartphone when I arrive at work

The main advantage of using IFTTT is indeed the availability of many services ready to use: starting from the ones which query weather forecast providers, to services which connect to famous social networks and even including services that can talk to smart devices like FitBit bracelets or Nest thermostats.

Besides the website, IFTTT is also available on Android and iOS smartphones; for this tutorial I’m going to use indeed a feature of this app, the notifications.

Maker Webhooks

Among the many services IFTTT offers, one is very handy to integrate IFTTT with IoT devices: the Maker Webhooks service. As the name suggests, this service allows applets to interface with the Web. If you add it as a This service (trigger, source of the event that activates the applet) Maker Webhooks allows to send an event to the applet using a web request (GET or POST), while if you add it as a That service (action that the applet performs), Maker Webhooks allows the applet to make a web call:

ifttt-13

The Maker Webhooks service is the first element of our applet: thanks to it we’ll be able to activate the applet with a web request performed by the ESP32 chip and we’ll be also able to pass optional values to the applet itself.

Notifications

The second service we’ll be using is called Notifications: using this service the applet can send notifications to our smartphone. The only requirement is that our smartphone is running the IFTTT app and that we log in with the same account used to create the applet.

Applet

Let’s see how to build the applet. After having registered to the website, click on New Applet.

First click on this:

ifttt-01

Type some letters of “Maker Webhooks” to search the service, then click on its icon:

ifttt-02

Select the only trigger the service offers:

ifttt-03

Type the name of the event that will activate the applet. You can choose the name we prefer; the same name will be used when making the web request:

ifttt-04

Now click on that:

ifttt-05

Search and select the Notifications service:

ifttt-06

Click on the only action the service offers:

ifttt-07

Customize the message that will be displayed as notification. You can also include some custom values that will be received by the applet via the web call, together with the event name:

ifttt-08

Complete the wizard with a click on Finish:

ifttt-09

Personal key

To be able to send a request to the Maker Webhooks service, you must specify your personal key. Connect to the service’s homepage and click on Settings:

ifttt-10

Copy the key, that is the string after /use/ in the service URL:

ifttt-11

esp32_ifttt_maker component

To simplify the interaction with the Maker Webhooks service, I developed a component that is ready to use with the esp-idf framework. You can compare components to libraries, reusable code elements for your programs. You only need to copy the component’s folder within the components folder of your project to be able to use it:

ifttt-14

My esp32_ifttt_maker component is available in a dedicated Github repository and I explained how to use it in details in a dedicated webpage of my website.

Demo

I prepared a demo program that sends notifications using IFTTT applets; its source code is on Github.

Here’s a video that shows how it works (italian subtitles are available):

Leave A Response »

This website uses cookies to ensure you get the best experience on our website maggiori informazioni

Questo sito utilizza i cookie per fonire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o clicchi su "Accetta" permetti al loro utilizzo.

Chiudi