Raspberry Pi

Raspberry Pi Full Stack: If This Then That (sample lecture) 

 March 2, 2020

By  Peter

Join Our Mailing List

We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad, Node-RED, drones and more. Listen to interviews. Learn about new tech with our comprehensive reviews. Get discount offers for our courses and books. Interact with our community.

One email per week, no spam, unsubscribe at any time.

A few days ago I published a significant update and extension of my course Raspberry Pi Full Stack. In its original format, this project course shows how to build a web application on the Raspberry Pi, from the ground up. The updated and extended version of the course adds support for the Raspberry Pi 4, Raspbian Buster, and Python 3.8.1. It also adds various bells and whistles, including support for IFTTT email notifications.

In this post, I am sharing a sample from one of the new lectures in the course.

This lecture is the introduction of one of the new sections that shows you how to setup IFTTT email alerts.

When the temperature or humidity go above a specific point (which, of course, you can control), your app will email you. Once you know how to do this, you will be able to do anything you want with IFTTT.

Enjoy 🙂

Transcript from this sample lecture

In the previous few lectures, we reworked our application so that it has support for one or more remote Arduino nodes using the RF24 transceiver to communicate with the Raspberry Pi.

And this is the state of our application.

Now, we can go to the front end and choose a sensor that would like to access the data for, and the data comes back.

You can see here, I noticed this as I was recording the previous lecture.

So what happened here is that between say around 4 p.m. yesterday and about half an hour ago, I had stopped the background service on the Raspberry Pi that receives data from the remote node and forgot, then to turn it back on.

And that’s why you see this big gap.

I haven’t shown you yet how to create this service, it is something we’re going to do in the next lecture.

But I just wanted to explain why there is this perfect straight line between these two points, because there’s no data in here.

All right.

So let’s move on.

What we’re going to do now is to use the “If This Then That” Web service to generate email alerts like this one right here.

So I’ve set it up so that when the temperature or the humidity go above a particular threshold, the application is going to use “If This Then That” to send me an email and in that email you’ll have the information from the sensor that triggered the email, like you can see right here.

So this is what we’re going to implement in this lecture.

To make this work we are going to use “If This Then That”.

And on the Python script side on our program, we are going to use a Python module called “Requests”.

And this module allows us to easily send a HTTP request at anywhere on the Web that can, in our case, trigger the email.

So before we have a look at the code itself that I’ve got here; I’ve got as usual, the original version of RF24 receiver on the left side and then the new version with few modifications that we need on the right side.

So before we get into this, just want to show you what the IFTTT.com side of this operation looks like and also help you to set it up.

So then we can go to the Python script and make the necessary modifications there.

So I’ve just logged on to IFTTT.com…


You may also like

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

I’m excited to introduce you to the latest and greatest version of KiCad – version 8 (stable release). This article will overview the new features and capabilities added to this popular open-source electronic design automation

Read More
KiCad 8: The new and updated features, a full review

Learning anything worth learning from the ground up is hard. The road to proficiency is filled with roadblocks, distractions, and dead-ends. Everyone learns differently and for different reasons. Some of us learn to advance our

Read More
From struggling to thriving: Understanding the journey from Beginner to Proficient (in programming or anything else)