In the last project of the chapter, we are going to see how to send a third type of notification: push notifications. These are perfect for important alerts, as they will show up right on your phone when they're triggered.
To do so, we'll be using an application called Pushover that exists for iOS and Android. You first need to create an account at:
Inside the Pushover dashboard, you'll need to get the API key; you'll need it in a moment to link Pushover to your IFTTT account.
Inside IFTTT, you can now connect the Pushover channel:
Now, we are ready to create the final recipe for this chapter. As the event name, this time choose alert:
Then, as the action channel, select the Pushover channel:
As the message for the push notification, you can choose what you want, for example a message saying that the humidity is too high:
Finally, save the recipe, which should now appear on your dashboard:
Let's now configure the ESP8266 board. As the sketch is really similar to the sketches we already saw, I will only tell you about what changed here.
The first thing we need to change is the name of the event sent to IFTTT:
const char* eventName = "alert";
Then, we set up the board to send an alert whenever the humidity rises above 30%:
if (h > 30.00) {
We also need to add a bigger delay when the alert is triggered, just to make sure you don't receive an alert every 5 seconds:
delay(10 * 60 * 1000);
It's finally time to test the project! Grab the code from GitHub, and change the Wi-Fi settings and also the IFTTT data. Then, upload the code to the board.
If the humidity is indeed above the threshold, you should receive a notification pretty soon on your phone:
This is much better than just an e-mail, as you'll see it even if you are not currently checking e-mails or text messages. Therefore, it's just perfect for urgent alerts, and you now know how to send those alerts right from your ESP8266.
3.148.107.254