using the host from the document.location
This commit is contained in:
parent
c9b90f2221
commit
a00d110f51
@ -10,6 +10,7 @@
|
|||||||
"atob": "^2.0.3",
|
"atob": "^2.0.3",
|
||||||
"babel-preset-es2015": "^6.14.0",
|
"babel-preset-es2015": "^6.14.0",
|
||||||
"basic-authentication": "^1.7.0",
|
"basic-authentication": "^1.7.0",
|
||||||
|
"better-npm-run": "0.0.13",
|
||||||
"body-parser": "^1.15.2",
|
"body-parser": "^1.15.2",
|
||||||
"btoa": "^1.1.2",
|
"btoa": "^1.1.2",
|
||||||
"cfenv": "1.0.x",
|
"cfenv": "1.0.x",
|
||||||
@ -36,8 +37,8 @@
|
|||||||
"sugar-date": "^2.0.2",
|
"sugar-date": "^2.0.2",
|
||||||
"uuid-pure": "^1.0.10",
|
"uuid-pure": "^1.0.10",
|
||||||
"websocket": "^1.0.23",
|
"websocket": "^1.0.23",
|
||||||
"ws": "^1.1.1",
|
"wemo-client": "^0.11.2",
|
||||||
"better-npm-run": "0.0.13"
|
"ws": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"after": "^0.8.1",
|
"after": "^0.8.1",
|
||||||
@ -84,8 +85,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server.js",
|
"start": "node server.js",
|
||||||
"build": "gulp default",
|
"build": "gulp default",
|
||||||
"production": "NODE_ENV=production node server.js"
|
"production": "NODE_ENV=production node server.js"
|
||||||
},
|
},
|
||||||
"author": "Martin Donnelly",
|
"author": "Martin Donnelly",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
20
wemo.js
Normal file
20
wemo.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
|
client.setBinaryState(1);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user