In this post, I will discuss how you can Automate with Alexa in a better way. A new habit I have recently adopted is taking the train to work in the morning. I don’t want to miss the train, which comes every half hour. A solution had to be found to be on the safe side. It takes just a few minutes on foot to get to the train station. There is no variable other than the wait time for the elevator since trains usually don’t come early. A narrow range of times is available for reaching the station, from the minimum to the maximum.
The approach in the beginning:
My thought was that some kind of reminder would be helpful to make sure I get going on time. Setting an alarm exactly 10 minutes before the train usually arrives is the simplest and easiest way to create a reminder to leave. On the other hand, this solution is not appealing to me because it requires me to manually disarm it if the alarm goes off, which takes more time and effort when I need to leave.
You can set Amazon’s Alexa device to remind you every workday to do so. To remind me to get ready every morning at 8:40 AM, I will receive this announcement.
To move the concept forward, we should retrieve data on real-time travel from the local public transportation company’s website and time the reminder accordingly. In this way, I can use my time at home rather than at the train station if I am delayed by the train.
One convenient way to receive notifications on Alexa devices is to use the device’s capabilities. By creating an application that pushes an Alexa notification, I can do that. Alexa devices provide notifications in an unconventional manner, even though this seems convenient. A yellow glowing ring appears on the device when I receive a notification, and I must interact with the device to hear it. This could lead to the same problem I would face if I had a simple alarm. Instead of getting started, I need to perform one more action.
An adequate solution:
In the end, I developed a mixture of approaches. Using Alexa, I schedule a routine. The arrival time of the train is announced by this routine weekly. So that I can prepare for any delays that may occur, I will be notified as soon as the train schedule is updated in real-time.
Two actions are performed in the routine:
- As a reminder, a text can be predefined
- The ability to customize text
The first action reminds me to prepare for departure, while the second is a custom (non-public) skill that tells me when the next train leaves.
For this purpose, I am developing an Alexa skill, so integrating it with routines appears convenient, but I have one restriction:
- In order to test Alexa skills that integrate with routines, the skill must be not in beta stage and may be tested via API
- Unless I want to keep my skill private, I can’t connect it without certification and publication
Custom text actions provide a quick and simple way to invoke a skill through the routine. You can also request the skill using the following syntax: Alexa, ask [skill name], [skill request text]. Routines are invoked when only the answer is read and not the question.
I enabled Full Address and Location Services permissions on Alexa to complete the process. If the Alexa application runs on a smartphone, I can retrieve the exact location with the coordinates of the Alexa device or the address of the device. Map APIs, such as Bing Maps API, can translate addresses into exact locations.
Based on the exact location, I can locate the closest train station and get its live schedule. My daily commute now includes the ability to ask Alexa about the train schedule on my phone – even when I’m on the way home.