Alexa Home Skill for Node-RED

Following on from my last post this time I’m looking at how to implement Alexa Home Skills for use with Node-RED.

Home Skills provide ON/OFF, Temperature, Percentage control for devices which should map to most home automation tasks.

To implement a Home Skill there are several parts that need to created.

Skill Endpoint

Unlike normal skills which can be implemented as either HTTP or Lambda endpoints, Home Skills can only be implemented as a Lambda function. The Lambda function can be written in one of three languages, Javascript, Python and Java. I’ve chosen to implement mine in Javascript.

For Home Skills the request is passed in a JSON object and can be one of three types of message:

  • Discovery
  • Control
  • System


These messages are triggered when you say “Alexa, discover devices”. The reply this message is when the skill has the chance to tell the Echo what devices are available to control and what sort of actions they support. Each device section includes it’s name and a description to be shown in the Alexa phone/tablet application.

The full list of supported actions:

  • SetTargetTemperature
  • IncrementTargetTemperature
  • DecrementTargetTemperature
  • SetPercentage
  • IncrementPercentage
  • DecrementPercentage
  • TurnOff
  • TurnOn
  • GetTemperatureReading 1
  • GetTargetTemperature 1
  • GetLockState 1
  • SetLockState 1

1 These actions are listed as only available in the US at the moment.


These are the actual control messages, triggered by something like “Alexa, set the bedroom lights to 20%”. It contains one of the actions listed earlier and the on/off or value of the change.


This is the Echo system checking that the skill is all healthy.

Linking Accounts

In order for the skill to know who’s echo is connecting we have to arrange a way to link an Echo to an account in the Skill. To do this we have to implement a oAuth 2.0 system. There is a nice tutorial on using passport to provide oAuth 2.0 services here, I used this to add the required HTTP endpoints needed.

Since there is a need to set up oAuth and to create accounts in order to authorise the oAuth requests this means that is makes sense to only do this once and to run it as a shared service for everybody (just got to work out where to host it and how to pay for it).

A Link to the Device

For this the device is actually Node-RED which is probably going to be running on people’s home network. This means something that can connect out to the Skill is probably best to allow or traversing NAT routers. This sounds like a good usecase for MQTT (come on, you knew it was coming). Rather than just use the built in MQTT nodes we have a custom set of nodes that make use of some of the earlier sections.

Firstly a config node that uses the same authentication details as account linking system to create oAuth token to be used to publish device details to the database and to authenticate with the MQTT broker.

Secondly a input node that pairs with the config node. In the input node settings a device is defined and the actions it can handle are listed.

Hooking it all together

At this point the end to end flow looks something like this:

Alexa -> Lambda -> HTTP to Web app -> MQTT to broker -> MQTT to Node-RED

At this point I’ve left the HTTP app in the middle, but I’m looking at adding direct database access to the Lambda function so it can publish control messages directly via MQTT.

Enough talk, how do I get hold of it!

I’m beta testing it with a small group at the moment, but I’ll be opening it up to everybody in a few days. In the mean time the code is all on github, the web side of all of this can be found here, the Lambda function is here and the Node-RED node is here, I’ll put it on npm as soon as the skill is public.


The skill should now be generally available in the UK,US and Germany

24 thoughts on “Alexa Home Skill for Node-RED”

    1. Because it’s doesn’t support Home Skill’s as far as I can tell so you need to prefix your commands with a skill name which is not as natural, and you need to open your Node-RED instance up to the internet to accept the incoming HTTP requests. My system connects out with MQTT so doesn’t need any port forwarding to work through NAT firewall/routers.

      Also as I mentioned in my previous post it doesn’t work if you’ve moved the Node-RED admin route. My pull request to fix that has been sat for over 2 weeks with out any response.

  1. Hi there,

    I found the node on, but I can’t seem to find the skill in the Alexa app. Is it out yet? If not, is there any estimate of release?

    Best regards

    1. The skill is with Amazon for approval, they don’t give estimates on how long that will take.

      The node was published to allow the beta test team and Amazon to test the skill. The will be another post when it is publicly available.

    1. Still waiting for a reply after resubmitting for approval. First time took over 3 weeks, I expect even longer with Christmas in the middle this time

  2. Great work Hardillb, installed node-red & tested working but awaiting Amazon Skill, looking forward to it, keep up the good work!


  3. Can’t wait for Amazon to approve this skill, really looking forward to using it on my raspberry pi with node-red!

  4. Can’t wait to test the skill! Also it would be nice if there was any way to add electronic locks. I’m already using Homebridge to open my Lockitron, if I could do the same with alexa it would be awesome.

    1. There has been a suggestion that new verbs will be added to the Home Skill to allow Open/Close actions in the future

  5. Once it is out in the wild, i’d love to translate it to german. Let me know if you need any help with that.

  6. Ben

    I want a skill where Alexa returns the recognised string into node-red via MQTT. I will then parse the string using regex. This will give me the ability to do anything which node red can do with voice activation. Then I want to send Alexa a string via MQTT and she speaks it. With bi-directional MQTT, I can do anything I want and build my own skills. Since you have been through the skills process, do you reckon that such a skill is possible within the existing constraints? It would give me complete voice control of all my node-red functions, because , as you are aware, string slicing to recognise keywords is easy in node red.

    1. This is not going to happen, Amazon have already removed the ability to get the a raw speech to text output (you can still force it by adding a intent of all #’s, but the match quality is crap, the intents help with the matching because it gives the engine a target to aim for). Also the interfaces for building skills are HTTP or Lambda so you would need to shim it to get a MQTT feed which you then need to make synchronous (which isn’t that hard but it does break a lot of point of MQTT).

      The best you can do is the node-red-contrib-alexa node I mentioned in my other post, but that does look to be an abandoned project as I’ve asked the author to add other maintainers to fix things and just been ignored.

      1. errrr without that feature Alexa to me is a useless paper weight……………. doh !!!!

        1. Depending on what you are using it for you could use OpenHab2 to do the mqtt triggering as the Openhab Alexa skill has just gone live. It’s commands like turn on / off / dim / set to 20% etc. Then you can have a lot of rules to handle the commands but I imagine you would use node-red for that.

          1. Those are exactly the same features that the Node-RED Alexa Home Skill offers so once Amazon finally approve it there would be no need to have the OpenHab bit in there as well.

          2. Teaches me to read the whole thread instead of searching terms. Fingers crossed it comes soon as that will be helpful, more so than the openhab one.

  7. Very interesting approach, but bit of a worry as well. As there is a shared webserver/appserver in there that sends out MQTT messages to my home automation system, it is possible for the admin owning this system to do anything he/she wants on my system. Or do you foresee people running their own webserver? that is not how I interpreted it until now.

    1. Yes theoretically the admin (me) could inject commands, but then again so could any Alexa Admin at Amazon for any skill, but you have to decide what level of trust works for you.

      If this sort of thing worries you that much, you probably should never have attached a 3rd party black box with a built in streaming microphone and the ability to directly control devices (see how Alexa interfaces with Wemo/Hue devices) to your lan.

      This service has been specifically designed to be multi-user so it is way more complicated (e.g. oAuth) than a single user system would need to be. If you want to own the whole stack you could build your own much simpler version and look at the Jasper project to replace the Alexa. Else most of the source for this project is up on github and linked to in the post if you want to have a look at it.

      Once approved this service and node will allow those slightly less technical users or those that just don’t want to invest the time and effort to build their own to quickly/simply hook up their Node-RED instance to Alexa.

  8. is this still active? will there be a release anytime soon? waiting for a solution like that desperately :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>