Building custom Alexa skills for my house

Posted on
Sun Dec 03, 2017 2:20 am
jmdraper offline
Posts: 102
Joined: Sep 11, 2014
Location: Surrey, UK

Building custom Alexa skills for my house

I don't yet have any Alexa devices but there's an Echo Dot on my Christmas list and I'm just thinking ahead ;-)

From what I can tell on the forums, the Alexa Hue bridge allows devices and actions in Indigo to be controlled from Alexa using turn on, turn off and dim commands. And using the Meta device plugin from Berkinet, non-dimmer devices can be controlled by wrapping them in that plugin to make them appear as dimmers. So you can control speaker volumes and the like that way (and possibly thermostats?). But the main limitation appears to be that you're limited to just being able to say turn on, turn off and dim / set to commands. (Oh, and it's one way so you can't ask Alexa about status in Indigo for example? - but I can live with that.)

What I'd love to be able to do is create custom skills for my house so that I can use more natural command forms and generally have a lot more flexibility. I understand the main limitation on this is the fact that Matt and Jay have bothered to make Indigo reflectors secure ;-) and that generally opening up a port allowing anyone to control my house is something I am unwilling to do.

So looking around for approaches to this, it seems to me that this post possibly contains the makings of a solution:

http://meistermeier.com/technology/2017/02/23/alexa-please.html

I should say I have never coded an Alexa skill or used an AWS Lambda function or MQTT before so I would be scratching around in the dark for a while before I ever managed to get this working. But I think the basic concept seems like it should work:

  • Custom Alexa skill calls on AWS Lambda function in response to utterances to Alexa
  • Lambda function pushes a command to an MQTT queue (running on AWS)
  • A bit of code running locally on the same machine as the Indigo server subscribes to that MQTT queue and receives the command
  • The code has configured logic which it uses to work out which calls to make to Indigo based on the command received
  • The code makes those calls to Indigo using the RESTful API - which it can do locally hence without any authentication issues

Further it seems to me from what I've read that per user (and possibly across all users) the AWS free tier would be sufficient to make this work since it offers 1 million Lambda function calls per month.

Can any developers out there who know more about this than I do confirm whether this approach should work / whether there are any major gotchas?

Thanks!
Jon

Posted on
Sun Dec 03, 2017 6:32 am
autolog offline
Posts: 3243
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT+1 aka UTC+1]

Re: Building custom Alexa skills for my house

Hi Jon,
jmdraper wrote:
... From what I can tell on the forums, the Alexa Hue bridge allows devices and actions in Indigo to be controlled from Alexa using turn on, turn off and dim commands. And using the Meta device plugin from Berkinet, non-dimmer devices can be controlled by wrapping them in that plugin to make them appear as dimmers. So you can control speaker volumes and the like that way (and possibly thermostats?). But the main limitation appears to be that you're limited to just being able to say turn on, turn off and dim / set to commands. ...


If you use actions then you can directly control Indigo devices regardless of types e.g. "Alexa dim speaker to 40" could result in an action setting a speaker volume to 40% or whatever scale the action defined. Likewise "Alexa dim thermostat to 21" could run an action to set the thermostat to 21 deg C.

I now also use Alexa Routines to use more natural speech. Previously I would say "Alexa turn on dining room curtains" to close them. With Routines I say "Alexa close dining room curtains" and likewise "Alexa open dining room curtains" to open them. So this is getting part way to more natural speech given the restraints of the Hue device emulation. I haven't yet discovered a way to pass a value to a Routine - it would be nice to say: "Alexa set speaker volume to 5".

With regards to the use of an Alexa Skill it is not an area I am that familiar with but having read the linked post it looks like it might be possible? There are already a couple of MQTT plugins that might help with this. :)

Posted on
Sun Dec 03, 2017 12:02 pm
jay (support) offline
Site Admin
User avatar
Posts: 16264
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Building custom Alexa skills for my house

I should note that if you know how to build an Alexa skill you can just build your own and hardcode in the reflector information (there's one on GitHub that already works - doesn't support the lighting API though). You just deploy it via your Amazon developer account and you're good.

It's not a general purpose solution of course, because you have to hard code the host/port information into the skill itself, but if you're good with JavaScript you can probably get it working.

BTW - I'm not necessarily recommending this solution, just pointing out so that if you're sufficiently technical you can take a stab at it if you want. A native skill is still quite high on the priority list, and in fact we made some architectural changes to the website in November that is the first step towards getting OAuth authentication working through an Indigo Account. Still lots of work to do, but we are making progress.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Dec 04, 2017 2:48 am
jmdraper offline
Posts: 102
Joined: Sep 11, 2014
Location: Surrey, UK

Re: Building custom Alexa skills for my house

Great thanks both for those responses. Very glad to hear it should be simpler than I thought to get it up and running pretty well for my purposes. I looked into how to build custom Alexa skills and it looks like it could plausibly be within reach. But then again I had not discovered Alexa Routines yet and that sounds like it will overcome one of my major concerns (natural speech commands) at least while I wait for the native skill which I am very glad to hear is high up on the list! And of course having OAuth working will be helpful for all sorts of other integrations too.

Now off to google Alexa Routines!

Thanks again,
Jon

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests