Getting an Amazon Echo last Father’s Day started a journey towards home automation which continues to amaze everyone in the house everyday. In many ways, this evolution has its foundation in Internet-of-Things (IoT) technology. The original use case for Echo (Alexa) was for the family, providing an ability to “Ask The Internet“, similar to an interactive Google Voice Response capability to replace sitting at a computer. Everyone in the house was getting more use out of “Alexa” than I was, in fact it seemed it was bought more for them rather than me!
While at Best Buy one day, I discovered WeMo. Belkin (WeMo), provides wi-fi enabled switches and plugs. The initial use case for WeMO was for home security; providing an ability to remotely control select lights and plugable devices while not in the home. That all changed when I discovered that WeMo was in fact Alexa-enabled to control these devices.
By selectively replacing standard wall switches and installing wi-fi WeMo switches and plugs Alexa voice-control of lights and pluggable devices was implemented, basic functionality for changing states (on/off). The advantage of course being hands-free interaction for lighting, fans and any plugged in device. Now while walking away from the kitchen for example you can say – “Alexa turn off Kitchen Lights“, thereby making physical interaction with switches a thing of the past. Furthermore, Echo provides the ability to group wi-fi switches together into collections; this means interactions like – “Alexa, turn off the Lights“, can turn off all the lights in the entire home which are wi-fi enabled.
After some investment, (approximately $400), the following environments are controlled almost entirely by Alexa, this includes:
- Kitchen Lights
- Table Lights
- Living Room Lights
- Playroom Lights
- Living Room TV
- Front Door Lights
- Playroom TV
- Select Room Fans
There are also various groups (collections) of devices, such as:
- Fans – all ceiling fans in all rooms
- Lights – all lights in Kitchen, Dining, Front-Door, Family Room, Game Room
- Locks – All door locks, including Garage
- Media – All TVs and Receivers
This means that in conversation with Alexa, these groups represent a sequence of events which can then be used as triggers in downstream orchestrations.
Of course being security minded is is best practice to setup a closed internal wi-fi network dedicated to home automation, thus isolating any potential exposure of the primary home’s internet.
Now Alexa was quickly becoming everyone’s best friend. In fact, we have become so dependent on Alexa, that we hardly ever turn lights on/off manually anymore. Our home is rather large, therefore installing an Echo Dot upstairs allows for a secondary invocation name – “Echo“, so that upstairs commands are isolated from the downstairs unit; this is recommended so that each “Access Point” for IoT, is planned accordingly to avoid issues in cross-conversational interactions. They both control the same devices, the invocation names are different – Alexa vs Echo – for example.
Over time we also discovered numerous other skills for Alexa, such as Nexia, which allows Alexa to control the environment in the home as well. Now we can simply ask “Alexa, set downstairs temperature to 75F“, and bingo – its done!
Alexa now fully integrated to control the lights, fans, TV and temperature makes life very dependent on her. Further research resulted in more capabilities being discovered such as Logitech Harmony.
Harmony is another wi-fi enabled hub which is intended to control smart devices like SmartTVs, game consoles, media players and Digital Receivers. After installing Harmony, we were able to add further intelligence such as “Alexa, ask Harmony to change TV to ABC“, and suddenly, the TV changes channels over the 9 – ABC. Standard TV controls like mute/volume are also available. Control on inputs on the SmartTV are provided to switch between devices like Ruku and Apple TV; say something like “Alexa, ask Harmony to watch Apple TV“, and she switches inputs on the SmartTV to HDMI 2 and turns on the Apple TV. Further, dialogs like, “Alexa find Blue Bloods” and she will switch to HDMI 3 and ask the Ruku to search for the TV show and then display all the places which it can be played. This is starting to introduce a “Jarvis-like” feel to the home.
To control home entry/access points (via voice), products like August Connect can be implemented, so that dialogs like – “Alexia is the front door locked“, or “Alexa, unlock the front door” are possible. This is also very helpful since it audits everything each time the door is opened and closed. The addition of iOS solutions like Lexi enables remote mobile support over the internet as a listener for Alexa, thereby externalizing Alexa functions and capabilities from outside the home.
The capabilities for these interactions continues to grow either via 3rd party SmartHubs (such as Wink). What is more impressive however is that complex integrations like the garage door can be enabled for Alexa by using your own custom code. For example, LiftMaster MyQ is a wi-fi enabled garage door switch which uses RFID between the garage door controller and an iOS app. Out-of-the-box there is no skill for Alexa with this MyQ device. While they do offer 3rd party account integration for Wink as an example, that requires the addition of yet another SmartHub – which is not necessary in all cases.
After a ton of digging around the web I came across a really interesting blog post by Blake Steck. This gentlemen is awesome! Blake wrote a blog post which explains step by step how to use Amazon micro-services in the cloud to integrate with your own custom Alexa skills to control the MyQ Garage Door.
This takes advantage of the AWS micro-services platform – Amazon Lambda. Using Lambda you can write your own custom code and deploy it as functions in the cloud which can be referenced by Amazon Alexa skills. Your custom skills do not need to be “Published”, so they can remain private under your own Amazon account. In this use case for MyQ, a custom python script is used to handle in the “Intents” as triggered within the ASK. The basic concept is to define the Lambda function as a custom application – then map the device handler to the “states” for a given request.
What is interesting in this implementation is that Lambda is providing exactly the same capabilities that many companies have implemented for creating internal business micro-services. Lambda provides these capabilities without all the complexity associated with the infrastructure to support it.
After your Lambda function is published in AWS, you can then develop your own custom skills for Alexa to invoke it. This is done via the ASK (Alexa Skill Kit). The ASK is extremely powerful. By providing the intent-schema, defining the states, and telling Alexa how to accept keywords (utterances) you can tailor the Alexa interaction to suit your needs.
For example, Blake’s code and instructions was used to create my own new MyQ skill for Alexa in minutes. Once provisioned it showed up in my Skills list in the Alexa app automatically. By enabling this custom skill I can simply say “Alexa, ask Garage Door to close“, and it does without the need for any other 3rd party hub. You can then use the ASK to test your skill dynamically and tweak as needed until you are happy with the results.
The combination of micro-services with simplified development kits like ASK is not only powerful, but revolutionary. This implies that anyone, and I mean anyone, has the ability to begin to create IoT applications for almost any device that uses a wi-fi integration capabilities. Amazon is also delivering a Wizard-like experience for creating Alexa skills, again putting the power of orchestrations formally used in big business into the hands of the average non-developer.
The next step in my SmartHome journey will be “Scenes and Activities“. This is where you group integrations together across hubs and micro-services to create targeted outcomes such as opening the door, setting the room temperature to 75F, turning on the TV and lights in the living room and setting it to channel 9, this would be called “Coming Home” for example. Others could be “Corner Store“, which would lock the doors, turn the TV off, play music for the dogs, leave only the kitchen lights on and turn on the security camera.
Once orchestrations are developed, I will focus on Event Triggers, such as security system integrations, these would call “Leave Home“, the opposite interactions of “Come Home“. The possibilities are endless.