Fix whitespace

This commit is contained in:
Sebastian Maier 2020-10-13 04:08:26 +02:00
parent 0155a5557e
commit 988d2ada35
2 changed files with 103 additions and 104 deletions

View File

@ -5,16 +5,15 @@ var colorOn = "\x1b[30;47m";
var colorOff = "\x1b[0m";
function SmartHomeNGConnection(platform, log, host, port) {
this.log = log;
this.platform = platform;
this.connected = false;
this.updateCallback = undefined;
this.tomonitor = [];
this.retryTimer = 10;
this.shng_host = host;
this.shng_port = port;
this.log = log;
this.platform = platform;
this.connected = false;
this.updateCallback = undefined;
this.tomonitor = [];
this.retryTimer = 10;
this.shng_host = host;
this.shng_port = port;
}
SmartHomeNGConnection.prototype.init = function () {
@ -55,7 +54,7 @@ SmartHomeNGConnection.prototype.connect = function(host, ip) {
}
SmartHomeNGConnection.prototype.receive = function(message) {
var msg = JSON.parse(message.utf8Data);
var msg = JSON.parse(message.utf8Data);
//this.log(msg);
if (msg.items) {
for (int = 0; int < msg.items.length; int++) {
@ -105,6 +104,6 @@ SmartHomeNGConnection.prototype.startMonitoring = function() {
}
module.exports = {
SmartHomeNGConnection: SmartHomeNGConnection
SmartHomeNGConnection: SmartHomeNGConnection
}

View File

@ -267,7 +267,7 @@ SmartHomeNGAccessory.prototype = {
monitoring.push({name: name, characteristic: characteristic.displayName, item: shngitem, callback: callback, inverted: inverted});
},
/** get methods
/** get methods
*
*/
getState: function(callback, shngitem, inverted) {
@ -315,7 +315,7 @@ SmartHomeNGAccessory.prototype = {
var numericValue = 0;
value = ( value>=0 ? (value<=100 ? value:100):0 ); //ensure range 0..100
if (inverted) {
numericValue = 100 - value;
numericValue = 100 - value;
} else {
numericValue = value;
}
@ -334,7 +334,7 @@ SmartHomeNGAccessory.prototype = {
var numericValue = 0;
value = ( value>=0 ? (value<=360 ? value:360):0 ); //ensure range 0..360
if (inverted) {
numericValue = 360 - value;
numericValue = 360 - value;
} else {
numericValue = value;
}
@ -348,35 +348,35 @@ SmartHomeNGAccessory.prototype = {
},
setInt: function(value, callback, context, shngitem) {
if (context === 'fromSHNG') {
if (callback) {
callback();
}
} else {
var numericValue = 0;
if (value && value>=0) {
numericValue = value;
}
this.log("["+ this.name +"] Setting " + shngitem + " int to %s", numericValue);
if (context === 'fromSHNG') {
if (callback) {
callback();
}
} else {
var numericValue = 0;
if (value && value>=0) {
numericValue = value;
}
this.log("["+ this.name +"] Setting " + shngitem + " int to %s", numericValue);
this.shngcon.setValue(shngitem, numericValue);
if (callback) callback();
}
}
},
setFloat: function(value, callback, context, shngitem) {
if (context === 'fromSHNG') {
if (callback) {
callback();
}
} else {
var numericValue = 0;
if (value && value>=0) {
numericValue = value;
}
this.log("["+ this.name +"] Setting " + shngitem + " float to %s", numericValue);
if (context === 'fromSHNG') {
if (callback) {
callback();
}
} else {
var numericValue = 0;
if (value && value>=0) {
numericValue = value;
}
this.log("["+ this.name +"] Setting " + shngitem + " float to %s", numericValue);
this.shngcon.setValue(shngitem, numericValue);
if (callback) callback();
}
}
},
/** bindCharacteristic
@ -471,10 +471,10 @@ SmartHomeNGAccessory.prototype = {
// Target temperature
if (config.targettemperature) {
this.log("["+ this.name +"] TemperatureSensor TargetTemperature characteristic enabled");
myService.getCharacteristic(Characteristic.TargetTemperature).setProps({
minValue: config.targettemperatureminimum || 0,
maxValue: config.targettemperaturemaximum || 40
});
myService.getCharacteristic(Characteristic.TargetTemperature).setProps({
minValue: config.targettemperatureminimum || 0,
maxValue: config.targettemperaturemaximum || 40
});
this.bindCharacteristic(myService, Characteristic.TargetTemperature, "Float", config.targettemperature, false);
}
/*