Automating My Routine With iOS & NFC
After moving into a new place recently, I’ve found myself tinkering with a lot of smart home concepts and devices. I am a big fan of the smart home movement - I currently have devices to control my lights, my AC, and my water heater.
All of these can be controlled in two ways - the first, obviously, is their respective manufacturer apps, and the second is by using a voice-controlled personal assistant (I’ve gone with Google’s platform due to my disappointment with Apple’s Siri).
So it was only natural that once I bought all of these devices, I’d want to start using the smart bits to automate stuff. I’ve already tried several workflows that proved to be extremely useful - the most significant one that comes to mind was using Geofences to turn on the AC whenever I got to a distance of 2km from my home, which made sure that even when the temperature outside is unbearably hot I would always come to a cool house.
Since setting up this solution was quite easy, I figured out I’d try to think of further automations to try.
Defining Sleep Routine
The things that struck me as the best candidate for automation was my sleep routine - both my habits of falling asleep and those of wake up. These are both pretty straight forward workflows, and both can easily defined:
Sleep Routine
- Turn off the lights
- Enable “Do Not Disturb”
- Turn on alarms
- Turn on sleep analysis using Sleep Cycle
Wake Up Schedule
- Turn on the lights on a specific, easy-on-the-eyes scene
- Turn off Do Not Disturb
- Play a playlist with nice, soft music
See? Easily defined. Now, to implement.
iOS Shortcuts
My weapon of choice is called Shortcuts, and it is available since iOS 13 as a default iOS app. Originally created as an external app called Workflow, it enables automation of simple processes on iOS devices. After Apple bought Workflow on March 2017, it went major changes and had since became an integrated part of the OS from iOS 12 onwards.
Previously I’ve had little interest in this app since it mostly required user interaction in order to trigger workflows - you would have to go into the app and select a flow to run, which (while time saving at times) was a rather heavy overhead for simple tasks. That is why in the past I choose to use other automation platforms (such as IFTT and Zapier), where things are happening based on external triggers and require no interactions.
However, things changed this past week when I discovered a feature called “Automations” which was added to Shortcuts with iOS 14. This feature allows Shortcuts to run based on triggers supplied by the OS rather than by the user. These include triggers such as time, location and more.
Using NFC
The automation type that struck me the most was NFC triggers. While it might not be the most useful one, I’ve been dreaming about NFC automation for years now, so I figured I’d give it a shot. After a quick Google search I found a store that sells packs of those, and within two days I had a 5-pack of these bad boys on my desk.
I’ve opened the shortcuts app, and configured the tags:
All I had to do now is to configure my shortcuts with the specification I’ve previously mentioned:
And that’s all! I’ve placed the tags (one for the morning routine, one for nighttime) on the corner of my bed, for easy access from the bed:
And that was it! Two tips that could’ve saved me a lot of debugging:
- Seems like the automation won’t run if the screen is off (it can be locked - showing the Lock Screen and waiting for unlock - but it must be on). I suspect that this is due to the battery optimizations - but for now at least that seems to be the case.
- There is a toggle called “Ask Before Running” - Make sure to turn it off. Otherwise, whenever this automation is about to run it will prompt you for confirmation, adding another annoying step in the way.
Conclusion
This was a fun exercise for me, which showed me again that going with a smart home strategy was a good idea. The magic of just touching a sticker with my phone and have the room around me change mood, play music, turn lights on and off - it really is a great demonstration of the power of IoT and smart appliances, and it’s a great party trick.
Onwards to the next tag!