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