Apology to teachers
Introduction
Even a mobile phone isn´t infallible! It may sometimes let you down and not wake you up. If it happens to you, don't despair. Press 👇 the smart button to apologize to your teacher before they inform your parents.
Under this project, you will learn how to send an e-mail using a smart button. 📩
All you need for this is the basic HARDWARIO Starter Kit.
Make it happen in Node-RED
-
Put the Starter Kit together and pair it: If you are doing this for the first time, we've prepared a simple guide for you. You need the radio push button firmware for the Core Module. If you don't know how to download the firmware or what it is,you can find out here.
-
In Playground, click the Functions tab where the Node-RED programming area is.🤖
-
Place the MQTT node from the Input section on the Node-RED area.
-
In the node, set the key function, i.e. push button. Double-click on the node and copy the following line into the Topic field:
node/push-button:0/push-button/-/event-count
Confirm with the Done button.
Set content of the apology
-
You also determine the content of the apology in Node-RED. Place Change node from the Functions section next to the MQTT node. This determines what e-mail is sent.
-
Double-click on the node and set two rules in the Rules field (see screenshot below).
The first rule will be **msg. payload **: this sets the message content. Keep in mind that the node is not familiar with Czech accent marks (čárky) and hooks (háčky) and don't forget to sign it. The message may read like this:
Dear Mr. Woodpecker, I'm sorry, but unfortunately my dog ate my alarm clock. I'll come a.s.a.p. Evzen (your favorite pupil, who does not deserve to have a note sent home to his parents).
In the second rule, which you add by pressing the + add button below, you fill in msg. topic. This will be the subject matter of the e-mail. For example Apology for being late.
Confirm with the Done button.👏
Start the app on your mobile
-
Continue on your mobile.. The e-mail is sent to the teacher at the touch of the button via the Blynk app. 📱 If you don't know Blynk yet from other projects, find out how to start it.
-
Select E-mail from the menu. ✉️ The button is placed on the project desktop.
- Clicking on the button takes you to settings. Here, set up your teacher's e-mail address to send your apology.
When you are finished, return to the desktop via the top left arrow and activate Blynk with the Play button in the top right.
Set up sending e-mails
-
Now return to Playground. Add E-mail node from Blynk ws after your flow. 📮
-
Double-click on the node and fill in the teacher's e-mail address on the E-mail line.
-
Then click on the pencil next to the Connection line and set some more details. In the Auth Token field, copy the code that Blynk sent to your e-mail account. In the URL field, copy the address from the bottom of the window (see screenshot) and give the function a name in the Name field, for example Apology.
-
Connect the nodes, press the Deploy button and relax: the e-mail that will save your life if you are late is ready! 🙏
Ready, steady… go!
- Do you want to try it? Change the e-mail address to your own for testing purposes.
- Confirm with Deploy again, then just press the button and ... hey presto, someone's writing you! 💌