1.0.11 • Published 11 years ago

wemonode v1.0.11

Weekly downloads
2
License
-
Repository
-
Last release
11 years ago

wemonode

A Node.js framework for managing Belkin Wemo socket and sensor

IMPORTANT: Remember to change "upnpBindAddress" in wemonode_config.json file

Usage example:

/* Requiring WemoNode module */
var WemoNode = require('wemonode');

/* Getting an instance */
var wemoNode = WemoNode.WemoNode();



/* Listening to "device_found" event.
    WemoNode will fire this event every time a new device is detected.
    If the detected device is a socket, then set the binary state to 1 (turn on)
*/
wemoNode.on("device_found", function (object) {

    if (object.deviceType == 'socket')
        wemoNode.sendCommand("socket_setbinarystate", object, {"binarystate": 1});


}.bind(this));



/* Listening to "device_lost" event.
    WemoNode will fire this event every time a device stops responding for 30 seconds.
 */
wemoNode.on("device_lost", function (object) {
}.bind(this));



/* Listening to "state_changed" event.
    WemoNode will fire this event every time a device changes its internal status.
 */
wemoNode.on("state_changed", function (object) {
    console.log("State changed emitted from " + object.id + " binaryState:" + object.binarystate);
}.bind(this));


var turnOffWemoSwitch = function(object){
    wemoNode.sendCommand("socket_setbinarystate", object, {"binarystate": 0});
}


wemoNode.startDiscovery();

setTimeout(wemoNode.stopDiscovery,10000);
1.0.11

11 years ago

1.0.10

12 years ago

1.0.9

12 years ago

1.0.8

12 years ago

1.0.7

12 years ago

1.0.6

12 years ago

1.0.5

12 years ago

1.0.4

12 years ago

1.0.3

12 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago