3

I'm looking at developing a plugin (probably an echo specific word for them) that will allow me to control a number of local hardware devices. The devices have a simple HTTP interface so very little plumbing should be required, however all the reading I've done so far (I'm new to the Echo API, so thats not that much yet) suggests that your code gets executed on remotely in the 'the cloud'. That being the case its going to struggle to access local resources without making them web facing (which isn't possible).

So as an example I want to write something that when you say "turn the kitchen light on". The echo box makes a http call to a local controller i.e. http://192.168.0.4/Light?room=kitchen&state=on

Is this possible, if so are there any simple examples about that I work from.

Thanks

PaulG
  • 13,871
  • 9
  • 56
  • 78
Sprotty
  • 5,676
  • 3
  • 33
  • 52

2 Answers2

3

They are called skills.

First the bad news: the Echo as you said doesn't talk to services on your local network.

The way people do this is by using Bespoken Tools or ngrok to proxy back commands to a server in your house from an AWS lambda skill. That server makes the calls to the devices.

Here is an example with Ruby: Alexa HUE

Let me know if you have more questions.

Bela Vizy
  • 1,133
  • 8
  • 19
  • Thanks I'll have a proper look at the example, but it appears to cover most of concepts I need. Its kind of limiting that they don't allow local network access, any idea what the rational for that is? ngrok seems like a good work around for hobby projects. Its seems to be the way a lot of the home automation software is going, pushing everything onto the cloud, but the last thing you need is the internet to go down and you can't get into your house... – Sprotty Nov 28 '16 at 11:51
  • with respect, this answer is wrong. See my answer below. – pinoyyid Dec 05 '17 at 12:22
0

Yes it is possible. See https://www.npmjs.com/package/node-red-contrib-alexa-local for a node-red plugin that allows Alexa to control local devices by emulating a Philips Hue.

No cloud skills required!!

My local setup has lights, a heater and my front door lock all controlled by Alexa. The key is that Alexa already has a built in HA skill which understands, for example Philips Hue. So provided you have something which emulates a Philips Hue, you're all set. The node red skill I linked to does just that.

So, my setup is:-

Alexa ---> Node-Red (using the module I linked to) ---> MQTT Broker ---> My devices

Node-Red and MQTT (Mosquitto) are both running on a Pi, and that is my "hub". My devices vary, so some are Sonoff running Tasmoto, others use custom NodeMCU boards that I have built. Once you have Node-red running, you can make it talk to just about any device using just about any interface. However, for HA, MQTT is far and away the best route to take rather than HTTP.

For remote access, I use the Telegram module in node-red to listen for commands coming from a Telegram bot that I created. This means I can sit on the train and type "heater on".

pinoyyid
  • 21,499
  • 14
  • 64
  • 115