From 4f57bbbaa0fead3cd9334745c2c12e1be73dcfb2 Mon Sep 17 00:00:00 2001 From: Foxi352 Date: Fri, 9 Sep 2016 15:29:22 +0200 Subject: [PATCH] Added thermostat --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index d04ed42..c4fb64b 100755 --- a/index.js +++ b/index.js @@ -398,6 +398,8 @@ SmartHomeNGAccessory.prototype = { // Create Thermostat service getThermostatService: function(config) { var myService = new Service.Thermostat(config.name,config.name); + + // Current temperature if (config.currenttemperature) { this.log("["+ this.name +"] TemperatureSensor CurrentTemperature characteristic enabled"); @@ -406,15 +408,17 @@ 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 + }); this.bindCharacteristic(myService, Characteristic.TargetTemperature, "Float", config.targettemperature, false); } if (config.temperaturedisplayunits && config.temperaturedisplayunits.toLowerCase() == 'fahrenheit') { this.bindCharacteristic(myService, Characteristic.TemperatureDisplayUnits, "Int", Characteristic.TemperatureDisplayUnits.FAHRENHEIT, false); - this.log("FAHRENHEIT: " + Characteristic. TemperatureDisplayUnits.FAHRENHEIT); } else { this.bindCharacteristic(myService, Characteristic.TemperatureDisplayUnits, "Int", Characteristic.TemperatureDisplayUnits.CELSIUS, false); - this.log("CELSIUS: " + Characteristic. TemperatureDisplayUnits.CELSIUS); } return myService; },