Wednesday, October 18, 2017

IFTTT (part 2): Creating My Own IFTTT Recipe

In my previous post, I walked through my experience activating an existing IFTTT recipe. In this post, I'll record my process for creating a custom IFTTT recipe. This recipe will send my partner a text message whenever I leave school. I'll read through this article to gain some background knowledge on the inner workings of IFTTT.

Here are some brief notes from the article I'm reading:
- "Trigger": the this in if this, then that; invokes the action
- "Action": the that in if this, then that; invoked by a trigger
- "Recipe": a trigger and its correspond action
- "Channel": a web service or connected device that will be used in a particular recipe

I opted to not complete the tutorial in the second half of the article, as I'm interested in building a location-based recipe with the goal of sending my partner a text message whenever I leave school. I'll follow this tutorial to learn how to create such a recipe.

After reading the sections on geofencing, installing the app, and exploring existing location-based recipes, I realized that the article is over 2 years old at the time of this writing. As a result, the in-app navigation instructions are outdated, as well as their claim that "there’s no way to craft a recipe through the IFTTT mobile app". In today's version of the app, there actually is a very simple way to create a recipe. At this point, I stopped following the tutorial and instead explored the app on my own for a while. Here are the steps I took to create my custom recipe on my iPhone (the Android process is likely similar): 

1. Download the IFTTT app from the App Store and create an account, if not already done.
2. Go to the "Search" tab and search for "location".



3. Scroll down and select "New Applet".



4. Select "Location" as the trigger. This is the type of event that will cause your desired action to    occur. 



5. Choose "You exit an area".



6. Adjust the map so that your desired exit area is selected, then click "Save". This is the geofence that will trigger your action when you exit it. 





*Note that you will have to allow IFTTT to access your location at all times in order for any location-based recipe to work. 
                                                  


7. Select SMS as the action service, then select "Send me an SMS". This will allow the recipe to send an SMS to a number of your choosing whenever the trigger event (in our case, leaving a designating location marked by our geofence) occurs. 



*Note that originally, the recipe will be configured to send to your phone number (assuming you have already provided IFTTT with it). To change this, simply click inside the applet and erase your phone number, then enter your desired phone number. You can also modify the rest of the recipe name as desired. 




8. Click "Finish", then make sure your newly minted IFTTT recipe is on. 





Congratulations, you now have a fully functional, location-based IFTTT recipe! Now test out the functionality by leaving your designated geofence area and see that your entered phone number receives an SMS. 

I won't be leaving the area I designated until at least late afternoon today, so I'll post an update here with whether or not the recipe worked as well as a screenshot of the results.

Thanks for reading! My brief journey into IFTTT was enlightening, and I can forsee many opportunities to integrate IFTTT into future IoT projects. The next stage of my IoT journey will be delving into the expansive and exciting world of Arduino using internet capabilities. I plan to make my first post on this subject sometime in the next week or so (depending on when my supplies arrive), so be on the look out for my next post!

UPDATE: Here's the message my roommate received when I left the area:




Friday, October 6, 2017

IFTTT (Part 1): Using a pre-existing IFTTT recipe

Besides AWS, another useful service for various IoT projects is IFTTT (If this, then that). This allows users to make one internet-enabled action trigger another internet-enabled action. For example, every time I take a picture on my iPhone, upload it to Dropbox.

I'm not planning to spend much time on this service, just enough to get my feet wet. In this post I'll document my experience using an existing IFTTT recipe, then I'll create my own IFTTT and document that process in a subsequent post.

After doing some research about IFTTT, I discovered that my city (Louisville, KY) has it's own set of custom-built applets. After scrolling through the numerous applets, one stood out: "Retrieve Air Quality and notify by SMS on change". It sends the user a text message every time the air quality level in the area changes. That sounds useful to me since I know the city has low air quality from time to time, and I don't want to be doing any cardio activities outside during those  times if possible.



After flipping the switch to the "On" position, I was prompted to enter  my phone number and the verification cod that was sent with it. 




After doing this, I wasn't sure if the function had been activated. Going to my applet dashboard, it appears that it has been activated.




However, I haven't yet received a text from the service. I'll update this post as soon I receive something. In the meantime, I'll begin building a custom IFTTT function! Check back soon for my post about the process. 


Update: Around 30 minutes after I activated the IFTTT applet, I received a second text with the following information: 



Pretty cool! I think I'll keep this activated for my personal information. However, I wish there was a way to get this emailed to me instead, as multiple texts per day from this service may get annoying. Regardless, this could prove to be a very useful function. 

UPDATE: After a day of having this feature on, I've decided to only turn it on for certain occasions. The reason for this is that the air quality changes so frequently (~once per hour, as seen in the screenshot below) that the constant notifications were bombarding my phone. I still think the feature is neat, but maybe it would be better if I program my AWS IoT Button (see previous posts) to send me a text with the current air quality whenever I press it, allowing me to only see the information when I want to see it.