mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Add HTTP timeout handler to Wemo nodes. (#629)
* 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
This commit is contained in:
parent
3fff2c404e
commit
6c446a96f2
@ -291,6 +291,11 @@ WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) {
|
||||
console.log("%j", postoptions);
|
||||
});
|
||||
|
||||
post_request.on('timeout', function (e) {
|
||||
console.log(e);
|
||||
console.log("%j");
|
||||
});
|
||||
|
||||
var body = [
|
||||
postbodyheader,
|
||||
'<u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">',
|
||||
@ -404,6 +409,12 @@ WeMoNG.prototype.getLightStatus = function getLightStatus(light) {
|
||||
def.reject();
|
||||
});
|
||||
|
||||
post_request.on('timeout', function (e) {
|
||||
console.log(e);
|
||||
console.log("%j");
|
||||
def.reject();
|
||||
});
|
||||
|
||||
post_request.write(util.format(getDevStatus.body, light.id));
|
||||
post_request.end();
|
||||
|
||||
@ -440,6 +451,11 @@ WeMoNG.prototype.setStatus = function setStatus(light, capability, value) {
|
||||
console.log("%j", postoptions);
|
||||
});
|
||||
|
||||
post_request.on('timeout', function (e) {
|
||||
console.log(e);
|
||||
console.log("%j");
|
||||
});
|
||||
|
||||
//console.log(util.format(setdevstatus.body, light.id, capability, value));
|
||||
|
||||
post_request.write(util.format(setdevstatus.body, light.type === 'light'?'NO':'YES',light.id, capability, value));
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-wemo",
|
||||
"version": "0.1.15",
|
||||
"version": "0.1.16",
|
||||
"description": "Input and Output nodes for Belkin WeMo devices",
|
||||
"repository": "https://github.com/node-red/node-red-nodes/tree/master/hardware",
|
||||
"main": "WeMoNG.js",
|
||||
|
Loading…
Reference in New Issue
Block a user