Ellery Coffman demonstrates home automation via Alexa

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

Ellery Coffman gets Alexa to start a movie on the TV, then stop it, and then play an album on the record player, and then stop it. This is impressive in all ways, except I was surprised at how slow it was. I’ve got an Alexa app running on a Rackspace server, which pulls data from Salesforce, and the response is much faster, despite the fact that there are 2 API calls involved, and despite the fact that Salesforce is notoriously slow. But other than that, I am impressed.

Since regular expressions tend to be slow, without knowing anything else about the system, I would guess this is the slow part:

I’ve written code (a Premise SpeechParser module) for my home automation system that actually interprets the sentence using nested regular expressions

Coffman writes:

Here’s what I’m using to do this:

1. Amazon’s Echo (aka Alexa)

2. KODI running on an nVidia Shield AndroidTV device

3. A free home automation program called Motorola Premise Home Control (http://cocoontech.com/forums/page/hom…)

4. A KODI module I’ve written for Premise allowing full two-way ip based functionality (including library importing) and IR too (so you can use the native Netflix 4k App that comes on the nVidia Shield without picking up another remote).

5. A very versatile SpeechParser module I’ve written for Premise, that takes a generic command phrase, then performs some action and forms a natural language response.

6. A new Amazon Echo skill I’m calling “Premise” that is in testing under my developer account. It uses an Intent called “Premise” to pass whatever is said after “Alexa ask Premise to” to my home automation server.

7. A free tiered Amazon Web Services (AWS) account to send Alexa commands to my home automation server over HTTPS. The same AWS lambda function also reads back an HTTP response of what actions took place that is sent from my home automation server (via the SpeechParser module).

Some additional even more geeky details:
Everything you see is done in a very generic fashion. No individual phrases were programmed for what you see in the video, I’m too lazy for that!

I’ve written code (a Premise SpeechParser module) for my home automation system that actually interprets the sentence using nested regular expressions to find what property state, property value, device type and room location you are trying to control based on what command you say.

In this manner, the command phrases are NOT order dependent (unlike most other options out there including Amazon’s), and leverage the object based structure of Premise, to recursively find a match within my home for whatever command is issued.

To elaborate, once found from the command phrase, the device type and room location are then used to examine all devices in the under a particular location (e.g. room) that match a particular device type (e.g. light). Once a match is found (e.g. table lamp in the living room), the properties under that object are compared using recursion to find the best match for the command sentence, and the new value is set.

The queries in the Part 2 video also work in a similar manner, but instead of setting a property value, they grab the value and return a response to the query.