Mom Finally gets a Call
I wanted to explore the notification protocol I used in my Creation and Computation project, it was rushed and I used code from a third party to get the notification working with IFTT, it wasn’t the best implementation as it lacked a lot of flexibility and there was no way to see any data logs of when the data was sent. This new way through AdaiO is ideal for the implementation of that IOT (internet of things) product.
I took this opportunity to rebuild the project with the new notification protocol though AdaIO and IFFTT as a whole. It uses some of the original code for getting the sensor information.
In this this write up I will focus mainly on the communication protocol as the Creation and Computation project mainly focuses on the product design and implementation of the circuit and design.
This time around I had already a proof of concept on how the project worked and now it was a matter of getting it to send that via AdaIO
Before I could tackle that I had to figure out how AdaIO worked and all the libraries involved in IOT, for this I re-created one of Adafruits ESP32 Feather projects of mailbox that has it flag go up when a email is received in gmail. This got me familiar with all the libraries and also the sample code for the feather was very useful to study for setting the wifi configuration. I got this working with my gmail account and was flooding my phone with IFTT notifications.
Here is the LINK to the project.
Once I had that working it was a matter of reverse engineering what I had learnt and got it to work the other way around, here another one of the code examples helped, its the most basic one called Adafruit io Publish.
The basic premise is I had to set up a function to send the AdaIO a variable once the light ON statement had triggered the function, it would then send the people I had set in IFTT an email telling them the lamp was ON. This is the exact same thing I had before but it was not saving any data on how many time it was triggered and also no way of controlling how many people received the email, it was a bit bootstrapped to fit the needs I had at the time.
Bits and Bops:
The code is all on git Hub but it is good to hi-light some of the main parts of the process. These do not have to be done in sequential order to work.
- AdafuitIO receives data on a certain channel and then triggers an event.
- Setup the feather to send that variable to Adafruit IO in a function which is triggered by an event, a sensor value, getting remote data etc, anything that says OK this happens DO that, where that sends the trigger.
- SetUp IFTT to react to the trigger in AdaIO, make sure you have the right settings in the
The project was a very interesting exploration, of the adfruit IO ecoSystem and all its different components, there is some limitation to the amount for data point you can send but for small projects you are fine. You can send direct email triggers through adafruitIO but it is not available to free accounts.
You can also have adafruit IO send you a notification when a value is received, in the trigger value.
Adfruit External Services: https://io.adafruit.com/imaginere/services
Adafruit Mailbox: https://learn.adafruit.com/gmailbox/3d-printing-the-mailbox
Adafruit Iot Library: https://learn.adafruit.com/category/internet-of-things-iot