Added thermostat

This commit is contained in:
Foxi352 2016-09-09 12:41:12 +02:00
parent 1859b247ae
commit 739c3274c8

View File

@ -153,6 +153,7 @@ SmartHomeNGAccessory.prototype = {
break; break;
case 'thermostat': case 'thermostat':
myServices.push(this.getThermostatService(this.config));
break; break;
case 'lightbulb': case 'lightbulb':
@ -393,6 +394,25 @@ SmartHomeNGAccessory.prototype = {
} }
return myService; return myService;
}, },
// 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");
this.bindCharacteristic(myService, Characteristic.CurrentTemperature, "Float", config.currenttemperature, false);
}
// Target temperature
if (config.targettemperature) {
this.log("["+ this.name +"] TemperatureSensor TargetTemperature characteristic enabled");
this.bindCharacteristic(myService, Characteristic.TargetTemperature, "Float", config.targettemperature, false);
}
this.bindCharacteristic(myService, Characteristic.TemperatureDisplayUnits, "Int", Characteristic.TemperatureDisplayUnits.CELSUIS, false);
return myService;
},
// Create Fan service // Create Fan service
getFanService: function(config) { getFanService: function(config) {