Remove most of the console.logs

This commit is contained in:
Ben Hardill 2021-04-08 12:02:29 +01:00
parent d7df13bc2b
commit a84fddc8f0
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
2 changed files with 27 additions and 18 deletions

View File

@ -229,12 +229,21 @@ module.exports = function(RED) {
node.status({fill: 'green',shape: 'dot',text: 'found'});
}
node.on('input', function(msg) {
node.on('input', function(msg, send, done){
var dev = wemo.get(node.dev);
send = send || function() { node.send.apply(node,arguments) }
if (!dev) {
//need to show that dev not currently found
console.log('no device found');
// console.log('no device found');
if (done) {
done("Device not discovered yet")
} else {
node.error("Device not discovered yet", msg)
}
return;
}

View File

@ -273,7 +273,7 @@ WeMoNG.prototype.start = function start() {
post_request.on('error', function(err){
// should log err
console.log(err);
//console.log(err);
})
post_request.write(util.format(getenddevs.body, udn));
@ -363,12 +363,12 @@ WeMoNG.prototype.toggleSocket = function toggleSocket(socket, on) {
});
post_request.on('error', function (e) {
console.log(e);
console.log("%j", postoptions);
// console.log(e);
// console.log("%j", postoptions);
});
post_request.on('timeout', function () {
console.log("Timeout");
// console.log("Timeout");
post_request.abort();
});
@ -420,8 +420,8 @@ WeMoNG.prototype.getSocketStatus = function getSocketStatus(socket) {
});
post_request.on('error', function (e) {
console.log(e);
console.log("%j", postoptions);
// console.log(e);
// console.log("%j", postoptions);
def.reject(e);
});
@ -471,8 +471,8 @@ WeMoNG.prototype.getInsightParams = function getInsightParams(socket) {
});
post_request.on('error', function (e) {
console.log(e);
console.log("%j", postoptions);
// console.log(e);
// console.log("%j", postoptions);
def.reject(e);
});
@ -527,12 +527,12 @@ WeMoNG.prototype.getLightStatus = function getLightStatus(light) {
def.resolve(obj);
} else {
def.reject(err);
console.log("err");
// console.log("err");
}
});
}
} else {
console.log("err");
// console.log("err");
def.reject(err);
}
});
@ -540,13 +540,13 @@ WeMoNG.prototype.getLightStatus = function getLightStatus(light) {
});
post_request.on('error', function (e) {
console.log(e);
console.log("%j", postoptions);
// console.log(e);
// console.log("%j", postoptions);
def.reject(e);
});
post_request.on('timeout', function () {
console.log("Timeout");
// console.log("Timeout");
post_request.abort("timeout");
def.reject();
});
@ -583,12 +583,12 @@ WeMoNG.prototype.setStatus = function setStatus(light, capability, value) {
});
post_request.on('error', function (e) {
console.log(e);
console.log("%j", postoptions);
// console.log(e);
// console.log("%j", postoptions);
});
post_request.on('timeout', function () {
console.log("Timeout");
// console.log("Timeout");
post_request.abort();
});