1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

More Wemo update (#631)

* Reduce resubscription time

Halve the resubscrciption timeout to make sure event
subscriptions get renewed

* Big Update

Includes:
 - New lookup node to check state of a device
 - Fix dimming control for lights
 - Fix light group control
 - Set the node label to match the device name
 - The event now includes the text description of the light capability

* Fix groups properly

* Fix travis error with comparitor

* Bump node-ssdp version

* Add extra check for empty results in discovery

* Bump twitter to 280 chars

fixes #371

* Bump twitter node version

* Remove extra whitespace

* Add catch for HTTP timeout

If the device drops off line then with no catch for the timeout
Node-RED will crash

Should fix #616

* More timeout catch blocks

* Version bump

* Bump Wemo version
This commit is contained in:
Ben Hardill 2020-04-11 10:47:47 +01:00 committed by GitHub
parent 397b7cdaec
commit 436f169fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 10 deletions

View File

@ -215,6 +215,10 @@ WeMoNG.prototype.start = function start() {
});
});
post_request.on('timeout', function(){
post_request.abort();
});
post_request.write(util.format(getenddevs.body, udn));
post_request.end();
@ -291,9 +295,9 @@ WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) {
console.log("%j", postoptions);
});
post_request.on('timeout', function (e) {
console.log(e);
console.log("%j");
post_request.on('timeout', function () {
console.log("Timeout");
post_request.abort();
});
var body = [
@ -347,6 +351,11 @@ WeMoNG.prototype.getSocketStatus = function getSocketStatus(socket) {
def.reject();
});
post_request.on('timeout', function(){
post_request.abort();
def.reject();
});
post_request.write(getSocketState.body);
post_request.end();
@ -409,9 +418,9 @@ WeMoNG.prototype.getLightStatus = function getLightStatus(light) {
def.reject();
});
post_request.on('timeout', function (e) {
console.log(e);
console.log("%j");
post_request.on('timeout', function () {
console.log("Timeout");
post_request.abort();
def.reject();
});
@ -451,9 +460,9 @@ WeMoNG.prototype.setStatus = function setStatus(light, capability, value) {
console.log("%j", postoptions);
});
post_request.on('timeout', function (e) {
console.log(e);
console.log("%j");
post_request.on('timeout', function () {
console.log("Timeout");
post_request.abort();
});
//console.log(util.format(setdevstatus.body, light.id, capability, value));
@ -493,9 +502,11 @@ WeMoNG.prototype.parseEvent = function parseEvent(evt) {
def.resolve(msg);
} else {
console.log("unhandled wemo event type \n%s", util.inspect(prop, {depth:null}));
}
} else {
//error
def.reject();
}
});

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-wemo",
"version": "0.1.16",
"version": "0.1.17",
"description": "Input and Output nodes for Belkin WeMo devices",
"repository": "https://github.com/node-red/node-red-nodes/tree/master/hardware",
"main": "WeMoNG.js",