Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including node-red-contrib-wemo-emulator with all npm packages installed. Try it out:

var nodeRedContribWemoEmulator = require("node-red-contrib-wemo-emulator")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-red-contrib-wemo-emulator v0.6.0

node-red-contrib-wemo-emulator

Why might you want to emulate Wemo? Well I wanted to be able to control my Node-RED Raspberry Pi using my Amazon Echo. The Echo has Wemo support built in so I thought I'd give it a try.

It's pretty cool to be able to say 'Alexa, turn my garden watering system on' and my Pi turns on the outdoor watering system.

This Node-RED node is only a slim wrapper around the marvellous wemore Wemo library written by Daniel Leong.

Installation

Change directory to your node red installation:

$ npm install node-red-contrib-wemo-emulator

Configuration

Drag the node on to your workspace, configure it as below and then ask Alexa to discover devices.

ConfigDescription
Node NameThis is the name of the node as it appears in the Node-RED workspace
Friendly NameThis is the name that you'll see in the list of devices known to Alexa, it's also the name that you use in voice commands
Unique IDThis ID should be unique across all the wemo-emulator nodes in your workspace
PortWemore can automatically select a port to listen on, but it is recommended that you enter a unique port and increment it for each wemo emulator node you add to your workspace. This ensures that the port never changes.
On TopicThis is the topic sent when you ask Alexa to turn your thing on
On PayloadThis is the payload sent when you ask Alexa to turn your thing on
Off TopicThis is the topic sent when you ask Alexa to turn your thing off
Off PayloadThis is the payload sent when you ask Alexa to turn your thing off

Troubleshooting

If Alexa can't discover the devices emulated by this node, please check you don't have a firewall blocking the following ports:

  • 1900/udp
  • You must also open the ports for all of the wemo emulator nodes configured

Enabling extra debugging

Install node-red-contrib-config and drag a config node into your workspace. Configure the node to set a global variable called wemo-emulator with a JSON value of {"debug": true}. Also make sure that the config tickbox for active is unchecked. Redeploy. Now click the button on the config node. This will trigger all instances of wemo-emulator to write extra logging to the os syslog next time they're invoked.

Experimental

The node-red msg object now contains a sender object which attempts to identify the echo which was spoken to. This is still under scrutiny and may or may not work for you.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free