Added thermostat
This commit is contained in:
parent
1859b247ae
commit
739c3274c8
20
index.js
20
index.js
@ -153,6 +153,7 @@ SmartHomeNGAccessory.prototype = {
|
||||
break;
|
||||
|
||||
case 'thermostat':
|
||||
myServices.push(this.getThermostatService(this.config));
|
||||
break;
|
||||
|
||||
case 'lightbulb':
|
||||
@ -393,6 +394,25 @@ SmartHomeNGAccessory.prototype = {
|
||||
}
|
||||
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
|
||||
getFanService: function(config) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user