Added thermostat
This commit is contained in:
parent
b916f4f8ba
commit
4f57bbbaa0
8
index.js
8
index.js
@ -398,6 +398,8 @@ SmartHomeNGAccessory.prototype = {
|
|||||||
// Create Thermostat service
|
// Create Thermostat service
|
||||||
getThermostatService: function(config) {
|
getThermostatService: function(config) {
|
||||||
var myService = new Service.Thermostat(config.name,config.name);
|
var myService = new Service.Thermostat(config.name,config.name);
|
||||||
|
|
||||||
|
|
||||||
// Current temperature
|
// Current temperature
|
||||||
if (config.currenttemperature) {
|
if (config.currenttemperature) {
|
||||||
this.log("["+ this.name +"] TemperatureSensor CurrentTemperature characteristic enabled");
|
this.log("["+ this.name +"] TemperatureSensor CurrentTemperature characteristic enabled");
|
||||||
@ -406,15 +408,17 @@ SmartHomeNGAccessory.prototype = {
|
|||||||
// Target temperature
|
// Target temperature
|
||||||
if (config.targettemperature) {
|
if (config.targettemperature) {
|
||||||
this.log("["+ this.name +"] TemperatureSensor TargetTemperature characteristic enabled");
|
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);
|
this.bindCharacteristic(myService, Characteristic.TargetTemperature, "Float", config.targettemperature, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.temperaturedisplayunits && config.temperaturedisplayunits.toLowerCase() == 'fahrenheit') {
|
if (config.temperaturedisplayunits && config.temperaturedisplayunits.toLowerCase() == 'fahrenheit') {
|
||||||
this.bindCharacteristic(myService, Characteristic.TemperatureDisplayUnits, "Int", Characteristic.TemperatureDisplayUnits.FAHRENHEIT, false);
|
this.bindCharacteristic(myService, Characteristic.TemperatureDisplayUnits, "Int", Characteristic.TemperatureDisplayUnits.FAHRENHEIT, false);
|
||||||
this.log("FAHRENHEIT: " + Characteristic. TemperatureDisplayUnits.FAHRENHEIT);
|
|
||||||
} else {
|
} else {
|
||||||
this.bindCharacteristic(myService, Characteristic.TemperatureDisplayUnits, "Int", Characteristic.TemperatureDisplayUnits.CELSIUS, false);
|
this.bindCharacteristic(myService, Characteristic.TemperatureDisplayUnits, "Int", Characteristic.TemperatureDisplayUnits.CELSIUS, false);
|
||||||
this.log("CELSIUS: " + Characteristic. TemperatureDisplayUnits.CELSIUS);
|
|
||||||
}
|
}
|
||||||
return myService;
|
return myService;
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user