mqtt_server/wemo.js

21 lines
465 B
JavaScript
Raw Normal View History

/**
* Created by martin on 1/7/17.
*/
var Wemo = require('wemo-client');
var wemo = new Wemo();
wemo.discover(function(deviceInfo) {
console.log('Wemo Device Found: %j', deviceInfo);
// Get the client for the found device
var client = wemo.client(deviceInfo);
// Handle BinaryState events
client.on('binaryState', function(value) {
console.log('Binary State changed to: %s', value);
});
// Turn the switch on
2017-01-07 18:21:24 +00:00
client.setBinaryState(0);
});