New WeMo node

844 views
Skip to first unread message

Ben Hardill

unread,
Jan 11, 2016, 7:40:01 AM1/11/16
to Node-RED
I've been playing with Belkin WeMo devices for a while and I've finally got my new Node-RED node in a nearly fit state.

The details are up here http://www.hardill.me.uk/wordpress/2016/01/11/new-wemo-nodes-for-node-red/

The Event node still stops getting updates every now and again and I'm still trying to work out where it's failing in extending the subscription.

Have a play and raise github issues (https://github.com/hardillb/node-red-contrib-wemo-ng) or pull requests with fixes.

I'll push it to npm later in the week once some people other than me have given it a try.

Nathanaël Lécaudé

unread,
Jan 11, 2016, 9:06:59 AM1/11/16
to Node-RED
This is great thanks ! Will try soon !

Ian Eagland

unread,
Jan 11, 2016, 10:45:34 AM1/11/16
to Node-RED
Hi

How do you install nodes from github?

I found an install example (for a different node) and tried that substiting the correct name of course, but got some errors. Do I also have to uninstall the wemo node I already have?

Regards

Ian

Ben Hardill

unread,
Jan 11, 2016, 11:05:18 AM1/11/16
to Node-RED
It should not clash with the existing node

Nicholas O'Leary

unread,
Jan 11, 2016, 11:11:13 AM1/11/16
to Node-RED Mailing List
In addition to what Ben said, just for completeness and fyi, you can also use the command:

    npm install hardillb/node-red-contrib-wemo-ng

npm knows to treat a package name with a '/' in as a github org/repo combination.

Nick

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Lindsay

unread,
Jan 11, 2016, 11:18:56 AM1/11/16
to Node-RED
Ooo nice. I'll have to give it a try.

Cheers

Andrew

Ian Eagland

unread,
Jan 12, 2016, 10:22:28 AM1/12/16
to Node-RED
Many thanks.

Worked a treat.

Regards

Ian

Ryan Annis

unread,
Jan 18, 2016, 3:54:58 PM1/18/16
to Node-RED
Hi Ben,

Great node, thanks. 

I have a Wemo Insight, WeMo-NG detected it OK but receives no status updates. Also I can turn the switch off but not on...any thoughts?

Cheers,
Ryan.

Ben Hardill

unread,
Jan 18, 2016, 6:23:40 PM1/18/16
to Node-RED
Ryan,

I have an insight as well and turning it off/on seams to work for me. What payloads are you sending to turn it off/on?

Also I'm getting events from the insight, but I'm still not confident the events are working properly they run for a while then just stop, it may just be my dodgy WiFi that means that the subscription renewals get missed from time to time.

Ryan Annis

unread,
Jan 19, 2016, 10:34:26 AM1/19/16
to Node-RED
Hi Ben,

My mistake, had been testing the different input formats and left it sending 0/1 as strings not integers, "0" worked but "1" didn't... works fine when done properly.

What's the expected behaviour for the subscriptions? Periodic? I had it running for a while hooked to a debug node but saw nothing reported.

Thanks,
Ryan

Ben Hardill

unread,
Jan 19, 2016, 12:36:22 PM1/19/16
to Node-RED
Ryan,

The insight sends messages when it changes state (off [0]/on no load [8]/load more than trigger power[1])

The other devices should be on state change

It also sends periodic messages about price per unit, but I'm not passing those through at the moment (they should get printed to the console) as I don't see the need.

I need to get my hands on a motion detector to add that in to the mix.

Also would be nice if Belkin did a 240v safe version of the light switch and to properly support the OSRAM Lightify bulbs, but I won't hold my breath (I'm still waiting for the android app to support custom icons for devices that have been shown in the screen shots for well over a year)

Jon Summers

unread,
Mar 10, 2016, 12:41:48 PM3/10/16
to Node-RED
Hi Ben, I'm a noob running node-red on a R-Pi with an image from Openenergymonitor. I've been using the original WeMo nodes successfully for about a month but I would appreciate the port hopping fixes in your new version. I have loaded the new nodes but they do not seem to find my two Switches or the Insight. The problem is that no devices appear in the Edit WeMoNG-dev config node or the Edit WeMoNG 'name' node.  On the main node-red sheet, the nodes just say 'searching'.  Is there anything obvious I could look for?

Thanks.

Ben Hardill

unread,
Mar 11, 2016, 1:40:15 AM3/11/16
to Node-RED
Two possible things here

1) The device discovery is asynchronous, it may take a little while (30 seconds) to discover devices. Close the node config dialogue and open it again. (The discovery repeats in the background as well every 60 seconds)

2) If you have a firewall in place it may be blocking the SDP discovery packets, try with it disabled

Jon Summers

unread,
Mar 15, 2016, 3:46:29 PM3/15/16
to Node-RED
Hi, I didn't mention that I had just upgraded the firmware in all my Switches and Insight - they are now on WeMo_WW_2.00.10062.PVT-OWRT-(Insight/SNS).
I can see that the discovery packets are being sent out but they are being ignored by the WeMo devices. I used an emulator app to send discovery packets out and, using this, I can get a response from the WeMo devices. I have set MAN to ssdp:discover but that did not help. Using Wireshark to compare the working packet verses the non-working packet, the only difference seems to be the source port. On the working packet both the source and destination ports are set to 1900 but on the non-working packet it is set at a higher random port. Please remember I am a noob, so my question is how and where can I set the source port?
Many thanks.

Ben Hardill

unread,
Mar 17, 2016, 6:00:15 AM3/17/16
to Node-RED
I'll check my devices when I get home, but they should all be on the latest levels and I'm not seeing any problems like this.

You can't set the src port as it comes from the built in node-ssdp module that I'm using to do the discovery.

Ian Eagland

unread,
Apr 22, 2016, 5:34:55 AM4/22/16
to Node-RED
Hi

I just had a NodeRed error that seems to be related to the wemo node.

From log

[red] Uncaught Exception:
21 Apr 14:17:39 - TypeError: Cannot call method 'addMembership' of null
    at addMembership [as _onTimeout] (/home/pi/.node-red/node_modules/node-red-contrib-wemo-ng/node_modules/node-ssdp/lib/index.js:183:19)
    at Timer.listOnTimeout [as ontimeout] (timers.js:121:15)

I am no programmer so I don't know what this means!

Regards

Ian

Ben Hardill

unread,
Apr 22, 2016, 7:57:40 AM4/22/16
to Node-RED
This looks like a failure in the underlying SSDP node which is used to discover the WeMo devices.

From a quick look at the code it seams to have failed to create a network socket to use to do the discovery on. Not sure if there is much more I can say about it without knowing everything about the network setup of the machine your running this on.

Have you only seen this the once or is it happening regularly?

Ian Eagland

unread,
Apr 23, 2016, 1:47:00 PM4/23/16
to Node-RED
Hi Ben

Only happened once so far.

Regards

Ian

Phil McDonnell

unread,
Dec 1, 2016, 7:50:29 PM12/1/16
to Node-RED
Hello, I am new to node-red and I just got it all up and running for a home automation system I am developing. I installed your Wemo node and it works great! Thank you for making it. I can't figure out how to capture the status from the Wemo switch to update my dashboard.

Basically I have a switch on my dashboard that works with the Wemo. I can turn it on and off and it works like a dream. However if I turn the same switch off from my Wemo app on my phone the lights go off, but my dashboard doesn't update, it still shows the switch being on.

I am sure this is probably something simple that I need to learn to dig further, but I tried all different nodes and nothing seemed to work.

Thanks!

Ben Hardill

unread,
Dec 2, 2016, 6:10:06 AM12/2/16
to Node-RED
Phil,

There are 2 Wemo nodes, the output one (which you seam to have found) and the input version. The input should subscribe to the socket events and output a message when the device changes state.

I don't actually use the event node much these days and it used to be a little flakey with renewing the uPnP subscriptions sometime so it would just stop getting updates.

Give that a try and I'll try and have a look to see if there is any way to recover when the subscription updates fails, the problem is that it can take a long time to fail so it's hard to test.

Also which nodes are you using? My WeMo NG nodes got rolled up into the original node-red-nodes-wemo package a while back and that's the only version that's been updated.

Phil McDonnell

unread,
Dec 2, 2016, 7:33:58 AM12/2/16
to Node-RED
Thanks for getting back to me.

So yes I have the output working fine. The input node seems to only work sometimes when I look at the debug screen. I have it dumping the payload there. I think what you said about it losing connectivity is right, seems to stop hearing the wemo.

What I was trying to do is get it to update my node-red dashboard when the switch was turned on or off somewhere else beside the node-red dashboard, my phone with the wemo app for instance. Doesn't seem to be a way to do it. How are others keeping the dashboard updated and in sync with the actual sensors?

I downloaded the latest right from the node-red site, they were both together if that helps...

I am thinking I might just go with an out of the box product like Home Assistant or OpenHab and not try to pretend I know what I am doing... :)

Thanks again for getting back to me...

Ben Hardill

unread,
Dec 2, 2016, 5:17:28 PM12/2/16
to Node-RED
Phil,

I've halved the resubscribe period and the event node seams a lot more stable (in a limited evening of testing).

If you want to test, you can edit line 72 in node-red-node-wemo/WeMoNG.js change the 200000 to 100000.

I'll give it a few days to really bed in and if it still looks good I'll push a new version of the node.

Stephen Mann

unread,
Oct 26, 2017, 5:19:35 PM10/26/17
to Node-RED
I have the same question as Phil- I hope I am not hijacking the thread-
So, is there a solution to showing the Wemo switch status in the Node Red dashboard?

Colin Law

unread,
Oct 27, 2017, 2:27:11 AM10/27/17
to node...@googlegroups.com
There are two parts to this, firstly reading the state in node red, and secondly showing it on the dashboard. You have not made it clear which one you are having difficulty with.

Colin


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack

---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/a5c35eb5-0cba-42da-8ab5-7e654be01155%40googlegroups.com.

Stephen Mann

unread,
Oct 30, 2017, 6:36:48 PM10/30/17
to Node-RED
Thanks for the reply.
On most of my MQTT devices, I publish a status topic after turning the device on or off. In Node Red I have an MQTT-in subscribing to that topic which in turn sets the switch indicator to match the status in msg.payload.  This way, no matter how the device is turned on or off, it publishes a status topic.  

The Wemo devices don't publish a msg.payload, but I see that it does return a raw message in the complete message object.

I guess my question should really be, how do I use the raw message?  Do I need to write a function to parse the raw message?  (If yes, do you have any tips where I can learn to write a Node Red function?)

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

gainestr

unread,
Oct 30, 2017, 7:16:14 PM10/30/17
to Node-RED
There is a status node that is able to check the current state of any node.  I use that to send updates to my phone when the switch on the wemo changes.  So therefore it doesn't matter if it was switched off within node-red, the wemo device itself or a power failure.

Stephen Mann

unread,
Oct 30, 2017, 10:36:28 PM10/30/17
to Node-RED
But the output of the status node is still the raw data.  How do I set the Switch node to reflect the status?

Thanks, Steve

gainestr

unread,
Oct 30, 2017, 11:08:10 PM10/30/17
to Node-RED
I just send the raw data from the status of the nodes ui_switch back to the switch node.  However,  I just found that it doesn't work with the newest version of Dashboard 2.6.0 so I had to revert back to v2.5.1 of Dashboard.
Here is an example that should work to test with.

[{"id":"c16636c2.6bc4a","type":"wemo in","z":"45ffd976.63fc18","name":"","topic":"wemo","device":"","label":"","x":134.5,"y":1640,"wires":[["a0135288.76353"]]},{"id":"a0135288.76353","type":"function","z":"45ffd976.63fc18","name":"","func":"var detect = msg.payload;\nvar status = detect.state;\nif (detect.state === \"0\") {\n    msg.payload = false;\n}\nelse (msg.payload = true);\nreturn msg;","outputs":1,"noerr":0,"x":266,"y":1640,"wires":[["af73de7d.6e3238"]]},{"id":"af73de7d.6e3238","type":"ui_switch","z":"45ffd976.63fc18","name":"","label":"Light On/Off","group":"3279f4c6.3156bc","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":434,"y":1639,"wires":[["ac2c3b7.d2ebdc8"]]},{"id":"ac2c3b7.d2ebdc8","type":"wemo out","z":"45ffd976.63fc18","name":"","label":"","x":616.5,"y":1638,"wires":[]},{"id":"29f131ea.1f69f6","type":"status","z":"45ffd976.63fc18","name":"","scope":[],"x":270.5,"y":1695,"wires":[["af73de7d.6e3238"]]},{"id":"3279f4c6.3156bc","type":"ui_group","z":"","name":"Wemo Switch","tab":"173dc723.a27df9","order":1,"disp":true,"width":"6"},{"id":"173dc723.a27df9","type":"ui_tab","z":"","name":"Wemo Switch(s)","icon":"dashboard","order":5}]

Ben Hardill

unread,
Oct 31, 2017, 8:53:32 AM10/31/17
to Node-RED
So put a function node or a change node to extract the bit you want from the data.

Stephen Mann

unread,
Oct 31, 2017, 10:13:01 AM10/31/17
to Node-RED
Wow, thanks.  You just provided me with the missing piece- the function to decode the raw data.
I suspected that a function would be the solution, but I spent considerable time looking for any tutorials or basic information about writing Node Red functions, and finding few. They all assume I already know Javascript- which I do not.  I am barely competent with C.
After slight mods to your function code (changing payload to "on" or "off"), it now works.  WooHoo.

Steve

Stephen Mann

unread,
Oct 31, 2017, 10:18:47 AM10/31/17
to Node-RED
Thanks for the reply.  Gainestr provided the path to a solution for me in the way of a function that works for him.
I suspected that a function would be the solution, but I don't know Javascript; I am barely competent with C.

I will also try using the change node - mostly to learn how to use it.

Thanks again.
Steve

Colin Law

unread,
Oct 31, 2017, 10:22:17 AM10/31/17
to node...@googlegroups.com
If you are going to do anything much with node-red then it would be
well worth your while investing some time in running through a
javascript tutorial.

Colin
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/node-red/4fc240dc-7ec8-4435-a10d-72cd9417f26a%40googlegroups.com.

gainestr

unread,
Oct 31, 2017, 10:41:15 AM10/31/17
to Node-RED
I'm glad you got it working.  My function had an extra var declaration line that wasn't even needed but I threw it together quickly and didn't really proof read it.  It worked when I tested it so I thought that you would figure out the rest and make your own modifications to it.  It's like a sickness, once you learn something, the knowledge spreads and becomes infectious.

Stephen Mann

unread,
Nov 30, 2017, 10:53:27 PM11/30/17
to Node-RED
Thanks, I have been referring to Javascript help sites to learn more.  I think I finally understand the JSON structure...
Now, I know enough to be really dangerous.

Steve
Reply all
Reply to author
Forward
0 new messages