Since I bought my first Echo device in 2017, I was enamoured by its simplicity, price point and how much value it added to my daily life. It has since become an essential member of our family - from turning on the TV and AV equipment, to giving my son 2 more minutes before he has to get out of bed and, by far, it's most import function, to calmly and patiently responding to what is the time?
As a technical person, I promised myself in 2020 that I would use my AWS Certified Alexa Skill Builder Certification (which is now retired) to create and publish Alexa skills.
Fast-forward 6 years, 12 Alexa devices (Echo One, Echo Show 957, Echo Living, Echo Study, Echo Bath, Echo D, Echo Guest, Echo Input, Echo Keri, Echo Movie, Echo Rennay and Echo Auto) and an Alexa specialty certification, I was still mortified that I had yet to publish a skill. Over this time, I did what most "enthusiast developers" do. I created a simple "Hello world" skill using the excellent documentation and was quite impressed at how simple it was to get up and running. Like any good Dad, I seized the opportunity to make Alexa say phrases to get a laugh from the kids. However, I could not find a a sufficient "use-case" to build a new skill.
Load shedding is a concept every South African knows and I've outlined my strategy in a previous post. We are super fortunate that we have a backup power solution. There are also great Apps, like ESP (EskomSePush), which we use to check the load shedding status and schedule. There are times when we just want to know the status - to use the kettle or not. To my knowledge, there is currently no way to check the status via Alexa! When I learnt that the ESP team had published an API to share this information, this was what I needed to create my skill!
As the image above shows, the ESP team have different billing models. As they are essentially a startup, they have to fund their operation. As a Developer, I am super appreciative of their efforts to publish an API to share the information - which has enabled initiatives like my Alexa skill. I'm also super proud that I signed up for a paid subscription a few days ago so I can keep the flywheel spinning.
ESP supports me and I support ESP. Herman Martiz, Dan Southwood-Wells (co-founders of ESP) - if you happen to read this - Thanks! You are an inspiration to the ZA Developer community.
Ok - back to the implementation. As you will note, there are a maximum number of API requests per day. Also, I had to design the solution to be available in the event the ESP API was unavailable.
This is my solution (outlined in the table below):
|1||I configured a CloudWatch Event rule that runs periodically - every 30 minutes|
|2||The target is a Lambda function|
|3||In the spirit of "simple" Lambda functions, this Lambda function would first read the latest National load shedding status|
|4||It then updates a DynamoDB table with the area and status|
|5||Like all great supporting acts, Lambda is the tech which underpins "almost" every Alexa skill. When my skill is invoked, the request is routed to this Lambda function for procesing.|
|6||The Lambda function (which uses the Alexa Skills Kit) reads from the DynamoDB table and responds to the query|
To further maximise this opportunity, I used the AWS Cloud Development Kit (CDK) to provision the infrastructure (Lambda functions, DynamoDB, CloudWatch Event Rule). You can find the code here:
Here is a quick snapshot of a request to the skill (via the Alexa Developer Console) and the DynamoDB.
Finally, I just want to highlight that the Certification process of the skill was super seamless. I received review feedback less than 15 hours after submission. For this version of the skill, I simply return the National Status. If there is sufficient demand, I may extend to return the schedule or times for a specific area.
As always, if you have any questions or suggestions, please do not hesitate to reach out via LinkedIn or firstname.lastname@example.org