mirror of
https://github.com/mtan93/homebridge.git
synced 2026-05-22 14:18:52 +01:00
Initial work. Still in progress
This commit is contained in:
+183
-249
@@ -1,5 +1,11 @@
|
|||||||
var types = require("HAP-NodeJS/accessories/types.js");
|
var types = require("HAP-NodeJS/accessories/types.js");
|
||||||
var nest = require('unofficial-nest-api');
|
var nest = require('unofficial-nest-api');
|
||||||
|
var Service = require("hap-nodejs").Service;
|
||||||
|
var Characteristic = require("hap-nodejs").Characteristic;
|
||||||
|
var Accessory = require("hap-nodejs").Accessory;
|
||||||
|
var uuid = require("hap-nodejs").uuid;
|
||||||
|
var inherits = require('util').inherits;
|
||||||
|
|
||||||
|
|
||||||
function NestPlatform(log, config){
|
function NestPlatform(log, config){
|
||||||
|
|
||||||
@@ -29,8 +35,9 @@ NestPlatform.prototype = {
|
|||||||
// it's a thermostat, adjust this to detect other accessories
|
// it's a thermostat, adjust this to detect other accessories
|
||||||
if (data.shared[deviceId].hasOwnProperty('current_temperature'))
|
if (data.shared[deviceId].hasOwnProperty('current_temperature'))
|
||||||
{
|
{
|
||||||
var name = data.shared[deviceId].name
|
var initialData = data.shared[deviceId];
|
||||||
var accessory = new NestThermostatAccessory(that.log, name, device, deviceId);
|
var name = initialData.name
|
||||||
|
var accessory = new NestThermostatAccessory(that.log, name, device, deviceId, initialData);
|
||||||
foundAccessories.push(accessory);
|
foundAccessories.push(accessory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,7 +49,7 @@ NestPlatform.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function NestThermostatAccessory(log, name, device, deviceId) {
|
function NestThermostatAccessory(log, name, device, deviceId, initialData) {
|
||||||
// device info
|
// device info
|
||||||
if (name) {
|
if (name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -53,21 +60,84 @@ function NestThermostatAccessory(log, name, device, deviceId) {
|
|||||||
this.serial = device.serial_number;
|
this.serial = device.serial_number;
|
||||||
this.deviceId = deviceId;
|
this.deviceId = deviceId;
|
||||||
this.log = log;
|
this.log = log;
|
||||||
|
Accessory.call(this, name, uuid.generate(deviceId));
|
||||||
|
|
||||||
|
this.getService(Service.AccessoryInformation)
|
||||||
|
.setCharacteristic(Characteristic.Manufacturer, "Nest")
|
||||||
|
.setCharacteristic(Characteristic.Model, this.model)
|
||||||
|
.setCharacteristic(Characteristic.SerialNumber, this.serial);
|
||||||
|
|
||||||
|
this.addService(Service.Thermostat, name);
|
||||||
|
|
||||||
|
this.getService(Service.Thermostat)
|
||||||
|
.setCharacteristic(Characteristic.TemperatureDisplayUnits, this.extractTemperatureUnits(device))
|
||||||
|
.on('get', this.getTemperatureUnits);
|
||||||
|
|
||||||
|
this.getService(Service.Thermostat)
|
||||||
|
.setCharacteristic(Characteristic.CurrentTemperature, this.extractCurrentTemperature(device))
|
||||||
|
//.getCharacteristic(Characteristic.CurrentTemperature)
|
||||||
|
.on('get', this.getCurrentTemperature);
|
||||||
|
|
||||||
|
this.getService(Service.Thermostat)
|
||||||
|
.setCharacteristic(Characteristic.TargetTemperature, this.extractTargetTemperature(device))
|
||||||
|
.on('get', this.getTargetTemperature)
|
||||||
|
.on('set', this.setTargetTemperature);
|
||||||
|
|
||||||
|
this.getService(Service.Thermostat)
|
||||||
|
.setCharacteristic(Characteristic.CurrentHeatingCoolingState, this.extractCurrentHeatingCooling(device))
|
||||||
|
.on('get', this.getCurrentHeatingCooling);
|
||||||
|
|
||||||
|
this.getService(Service.Thermostat)
|
||||||
|
.setCharacteristic(Characteristic.TargetHeatingCoolingState, this.extractTargetHeatingCooling(device))
|
||||||
|
.on('get', this.getTargetHeatingCoooling)
|
||||||
|
.on('set', this.setTargetHeatingCooling);
|
||||||
|
|
||||||
|
//this.getService(Service.Thermostat)
|
||||||
|
// .getCharacteristic(Characteristic.CurrentRelativeHumidity)
|
||||||
|
// .on('get', function(callback) {
|
||||||
|
// that.getCurrentRelativeHumidity(function(currentRelativeHumidity){
|
||||||
|
// callback(currentRelativeHumidity);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
inherits(NestThermostatAccessory, Accessory);
|
||||||
|
//NestThermostatAccessory.prototype.parent = Accessory.prototype;
|
||||||
|
Service.prototype.getCharacteristic = function(name) {
|
||||||
|
// returns a characteristic object from the service
|
||||||
|
// If Service.prototype.getCharacteristic(Characteristic.Type) does not find the characteristic,
|
||||||
|
// but the type is in optionalCharacteristics, it adds the characteristic.type to the service and returns it.
|
||||||
|
var index, characteristic;
|
||||||
|
for (index in this.characteristics) {
|
||||||
|
characteristic = this.characteristics[index];
|
||||||
|
if (typeof name === 'string' && characteristic.displayName === name) {
|
||||||
|
return characteristic;
|
||||||
|
}
|
||||||
|
else if (typeof name === 'function' && characteristic instanceof name) {
|
||||||
|
return characteristic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof name === 'function') {
|
||||||
|
for (index in this.optionalCharacteristics) {
|
||||||
|
characteristic = this.optionalCharacteristics[index];
|
||||||
|
if (characteristic instanceof name) {
|
||||||
|
return this.addCharacteristic(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
NestThermostatAccessory.prototype = {
|
NestThermostatAccessory.prototype.getServices = function() {
|
||||||
getCurrentHeatingCooling: function(callback){
|
return this.services;
|
||||||
|
};
|
||||||
var that = this;
|
|
||||||
|
|
||||||
this.log("Checking current heating cooling for: " + this.name);
|
|
||||||
nest.fetchStatus(function (data) {
|
|
||||||
var device = data.device[that.deviceId];
|
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.extractCurrentHeatingCooling = function(device){
|
||||||
var currentHeatingCooling = 0;
|
var currentHeatingCooling = 0;
|
||||||
switch(device.current_schedule_mode) {
|
switch(device.current_schedule_mode) {
|
||||||
case "OFF":
|
case "OFF":
|
||||||
targetHeatingCooling = 0;
|
currentHeatingCooling = 0;
|
||||||
break;
|
break;
|
||||||
case "HEAT":
|
case "HEAT":
|
||||||
currentHeatingCooling = 1;
|
currentHeatingCooling = 1;
|
||||||
@@ -81,21 +151,19 @@ NestThermostatAccessory.prototype = {
|
|||||||
default:
|
default:
|
||||||
currentHeatingCooling = 0;
|
currentHeatingCooling = 0;
|
||||||
}
|
}
|
||||||
that.log("Current heating for " + this.name + "is: " + currentHeatingCooling);
|
this.log("Current heating for " + this.name + "is: " + currentHeatingCooling);
|
||||||
callback(currentHeatingCooling);
|
return currentHeatingCooling;
|
||||||
});
|
};
|
||||||
|
NestThermostatAccessory.prototype.getCurrentHeatingCooling = function(callback){
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
getTargetHeatingCoooling: function(callback){
|
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
|
this.log("Checking current heating cooling for: " + this.name);
|
||||||
this.log("Checking target heating cooling for: " + this.name);
|
|
||||||
nest.fetchStatus(function (data) {
|
nest.fetchStatus(function (data) {
|
||||||
var device = data.device[that.deviceId];
|
var device = data.device[that.deviceId];
|
||||||
|
var currentHeatingCooling = that.extractCurrentHeatingCooling(device);
|
||||||
|
callback(currentHeatingCooling);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
NestThermostatAccessory.prototype.extractTargetHeatingCooling = function(device){
|
||||||
var targetHeatingCooling = 0;
|
var targetHeatingCooling = 0;
|
||||||
switch(device.target_temperature_type) {
|
switch(device.target_temperature_type) {
|
||||||
case "off":
|
case "off":
|
||||||
@@ -113,64 +181,105 @@ NestThermostatAccessory.prototype = {
|
|||||||
default:
|
default:
|
||||||
targetHeatingCooling = 0;
|
targetHeatingCooling = 0;
|
||||||
}
|
}
|
||||||
that.log("Current target heating for " + this.name + " is: " + targetHeatingCooling);
|
this.log("Current target heating for " + this.name + " is: " + targetHeatingCooling);
|
||||||
callback(targetHeatingCooling);
|
return targetHeatingCooling;
|
||||||
});
|
};
|
||||||
},
|
NestThermostatAccessory.prototype.getTargetHeatingCoooling = function(callback){
|
||||||
|
|
||||||
getCurrentTemperature: function(callback){
|
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
|
this.log("Checking target heating cooling for: " + this.name);
|
||||||
nest.fetchStatus(function (data) {
|
|
||||||
var device = data.shared[that.deviceId];
|
|
||||||
that.log("Current temperature for " + this.name + " is: " + device.current_temperature);
|
|
||||||
callback(device.current_temperature);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
getTargetTemperature: function(callback){
|
|
||||||
|
|
||||||
var that = this;
|
|
||||||
|
|
||||||
nest.fetchStatus(function (data) {
|
|
||||||
var device = data.shared[that.deviceId];
|
|
||||||
that.log("Target temperature for " + this.name + " is: " + device.target_temperature);
|
|
||||||
callback(device.target_temperature);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
getTemperatureUnits: function(callback){
|
|
||||||
|
|
||||||
var that = this;
|
|
||||||
|
|
||||||
nest.fetchStatus(function (data) {
|
nest.fetchStatus(function (data) {
|
||||||
var device = data.device[that.deviceId];
|
var device = data.device[that.deviceId];
|
||||||
|
var targetHeatingCooling = that.extractTargetHeatingCooling(device);
|
||||||
|
callback(targetHeatingCooling);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.extractCurrentTemperature = function(device){
|
||||||
|
var curTemp = this.extractAsDisplayUnit(device.current_temperature, device);
|
||||||
|
this.log("Current temperature for " + this.name + " is: " + curTemp);
|
||||||
|
return curTemp;
|
||||||
|
};
|
||||||
|
NestThermostatAccessory.prototype.getCurrentTemperature = function(callback){
|
||||||
|
var that = this;
|
||||||
|
nest.fetchStatus(function (data) {
|
||||||
|
var device = data.shared[that.deviceId];
|
||||||
|
var curTemp = this.extractCurrentTemperature(device);
|
||||||
|
callback(curTemp);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.extractTargetTemperature = function(device){
|
||||||
|
var targetTemp;
|
||||||
|
if (device.target_temperature != undefined) {
|
||||||
|
targetTemp = device.target_temperature;
|
||||||
|
} else if (device.temperature_lock_high_temp != undefined) {
|
||||||
|
targetTemp = device.temperature_lock_high_temp;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetTemp = this.extractAsDisplayUnit(targetTemp, device);
|
||||||
|
this.log("Target temperature for " + this.name + " is: " + targetTemp);
|
||||||
|
return targetTemp;
|
||||||
|
};
|
||||||
|
NestThermostatAccessory.prototype.getTargetTemperature = function(callback){
|
||||||
|
var that = this;
|
||||||
|
nest.fetchStatus(function (data) {
|
||||||
|
var device = data.shared[that.deviceId];
|
||||||
|
var targetTemp = this.extractTargetTemperature(device);
|
||||||
|
callback(targetTemp);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.extractTemperatureUnits = function(device) {
|
||||||
var temperatureUnits = 0;
|
var temperatureUnits = 0;
|
||||||
switch(device.temperature_scale) {
|
switch(device.temperature_scale) {
|
||||||
case "F":
|
case "F":
|
||||||
that.log("Tempature unit for " + this.name + " is: " + "Fahrenheit");
|
this.log("Tempature unit for " + this.name + " is: " + "Fahrenheit");
|
||||||
temperatureUnits = 1;
|
temperatureUnits = 1;
|
||||||
break;
|
break;
|
||||||
case "C":
|
case "C":
|
||||||
that.log("Tempature unit for " + this.name + " is: " + "Celsius");
|
this.log("Tempature unit for " + this.name + " is: " + "Celsius");
|
||||||
temperatureUnits = 0;
|
temperatureUnits = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
temperatureUnits = 0;
|
temperatureUnits = 0;
|
||||||
}
|
}
|
||||||
|
return temperatureUnits;
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.isFahrenheitUnit = function(unit) {
|
||||||
|
return unit == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.convertToDisplayUnit = function(value, displayUnit) {
|
||||||
|
return this.isFahrenheitUnit(displayUnit) ? nest.ctof(value) : value;
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.convertToValueUnit = function(value, displayUnit) {
|
||||||
|
return this.isFahrenheitUnit(displayUnit) ? nest.ftoc(value) : value;
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.extractAsDisplayUnit = function(value, device) {
|
||||||
|
var tempUnit = this.extractTemperatureUnits(device);
|
||||||
|
return this.convertToDisplayUnit(value, tempUnit);
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.extractAsValueUnit = function(value, device) {
|
||||||
|
return this.convertToValueUnit(value, this.extractTemperatureUnits(device));
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.getTemperatureUnits = function(callback){
|
||||||
|
var that = this;
|
||||||
|
nest.fetchStatus(function (data) {
|
||||||
|
var device = data.device[that.deviceId];
|
||||||
|
var temperatureUnits = that.extractTemperatureUnits(device);
|
||||||
callback(temperatureUnits);
|
callback(temperatureUnits);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.getCurrentRelativeHumidity = function(callback){
|
||||||
},
|
|
||||||
|
|
||||||
getCurrentRelativeHumidity: function(callback){
|
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
@@ -181,12 +290,9 @@ NestThermostatAccessory.prototype = {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
};
|
||||||
|
|
||||||
setTargetHeatingCooling: function(targetHeatingCooling){
|
|
||||||
|
|
||||||
var that = this;
|
|
||||||
|
|
||||||
|
NestThermostatAccessory.prototype.setTargetHeatingCooling = function(targetHeatingCooling, callback){
|
||||||
var targetTemperatureType = 'off';
|
var targetTemperatureType = 'off';
|
||||||
switch(targetHeatingCooling) {
|
switch(targetHeatingCooling) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -208,190 +314,18 @@ NestThermostatAccessory.prototype = {
|
|||||||
this.log("Setting target heating cooling for " + this.name + " to: " + targetTemperatureType);
|
this.log("Setting target heating cooling for " + this.name + " to: " + targetTemperatureType);
|
||||||
nest.setTargetTemperatureType(this.deviceId, targetTemperatureType);
|
nest.setTargetTemperatureType(this.deviceId, targetTemperatureType);
|
||||||
|
|
||||||
|
if (callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
},
|
NestThermostatAccessory.prototype.setTargetTemperature = function(targetTemperature, callback){
|
||||||
|
|
||||||
setTargetTemperature: function(targetTemperature){
|
|
||||||
|
|
||||||
var that = this;
|
|
||||||
|
|
||||||
this.log("Setting target temperature for " + this.name + " to: " + targetTemperature);
|
this.log("Setting target temperature for " + this.name + " to: " + targetTemperature);
|
||||||
nest.setTemperature(this.deviceId, targetTemperature);
|
nest.setTemperature(this.deviceId, targetTemperature);
|
||||||
|
if (callback) {
|
||||||
|
callback();
|
||||||
},
|
|
||||||
|
|
||||||
getServices: function() {
|
|
||||||
var that = this;
|
|
||||||
return [{
|
|
||||||
sType: types.ACCESSORY_INFORMATION_STYPE,
|
|
||||||
characteristics: [{
|
|
||||||
cType: types.NAME_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
perms: ["pr"],
|
|
||||||
format: "string",
|
|
||||||
initialValue: this.name,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Name of the accessory",
|
|
||||||
designedMaxLength: 255
|
|
||||||
},{
|
|
||||||
cType: types.MANUFACTURER_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
perms: ["pr"],
|
|
||||||
format: "string",
|
|
||||||
initialValue: "Nest",
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Manufacturer",
|
|
||||||
designedMaxLength: 255
|
|
||||||
},{
|
|
||||||
cType: types.MODEL_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
perms: ["pr"],
|
|
||||||
format: "string",
|
|
||||||
initialValue: this.model,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Model",
|
|
||||||
designedMaxLength: 255
|
|
||||||
},{
|
|
||||||
cType: types.SERIAL_NUMBER_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
perms: ["pr"],
|
|
||||||
format: "string",
|
|
||||||
initialValue: this.serial,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "SN",
|
|
||||||
designedMaxLength: 255
|
|
||||||
},{
|
|
||||||
cType: types.IDENTIFY_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
perms: ["pw"],
|
|
||||||
format: "bool",
|
|
||||||
initialValue: false,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Identify Accessory",
|
|
||||||
designedMaxLength: 1
|
|
||||||
}]
|
|
||||||
},{
|
|
||||||
sType: types.THERMOSTAT_STYPE,
|
|
||||||
characteristics: [{
|
|
||||||
cType: types.NAME_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
perms: ["pr"],
|
|
||||||
format: "string",
|
|
||||||
initialValue: this.name,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Name of thermostat",
|
|
||||||
designedMaxLength: 255
|
|
||||||
},{
|
|
||||||
cType: types.CURRENTHEATINGCOOLING_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
onRead: function(callback) {
|
|
||||||
that.getCurrentHeatingCooling(function(currentHeatingCooling){
|
|
||||||
callback(currentHeatingCooling);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
perms: ["pr","ev"],
|
|
||||||
format: "int",
|
|
||||||
initialValue: 0,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Current Mode",
|
|
||||||
designedMaxLength: 1,
|
|
||||||
designedMinValue: 0,
|
|
||||||
designedMaxValue: 2,
|
|
||||||
designedMinStep: 1,
|
|
||||||
},{
|
|
||||||
cType: types.TARGETHEATINGCOOLING_CTYPE,
|
|
||||||
onUpdate: function(value) {
|
|
||||||
that.setTargetHeatingCooling(value);
|
|
||||||
},
|
|
||||||
onRead: function(callback) {
|
|
||||||
that.getTargetHeatingCoooling(function(targetHeatingCooling){
|
|
||||||
callback(targetHeatingCooling);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
perms: ["pw","pr","ev"],
|
|
||||||
format: "int",
|
|
||||||
initialValue: 0,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Target Mode",
|
|
||||||
designedMinValue: 0,
|
|
||||||
designedMaxValue: 3,
|
|
||||||
designedMinStep: 1,
|
|
||||||
},{
|
|
||||||
cType: types.CURRENT_TEMPERATURE_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
onRead: function(callback) {
|
|
||||||
that.getCurrentTemperature(function(currentTemperature){
|
|
||||||
callback(currentTemperature);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
perms: ["pr","ev"],
|
|
||||||
format: "int",
|
|
||||||
initialValue: 20,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Current Temperature",
|
|
||||||
unit: "celsius"
|
|
||||||
},{
|
|
||||||
cType: types.TARGET_TEMPERATURE_CTYPE,
|
|
||||||
onUpdate: function(value) {
|
|
||||||
that.setTargetTemperature(value);
|
|
||||||
},
|
|
||||||
onRead: function(callback) {
|
|
||||||
that.getTargetTemperature(function(targetTemperature){
|
|
||||||
callback(targetTemperature);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
perms: ["pw","pr","ev"],
|
|
||||||
format: "int",
|
|
||||||
initialValue: 20,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Target Temperature",
|
|
||||||
designedMinValue: 16,
|
|
||||||
designedMaxValue: 38,
|
|
||||||
designedMinStep: 1,
|
|
||||||
unit: "celsius"
|
|
||||||
},{
|
|
||||||
cType: types.TEMPERATURE_UNITS_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
onRead: function(callback) {
|
|
||||||
that.getTemperatureUnits(function(temperatureUnits){
|
|
||||||
callback(temperatureUnits);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
perms: ["pr","ev"],
|
|
||||||
format: "int",
|
|
||||||
initialValue: 0,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Unit",
|
|
||||||
},{
|
|
||||||
cType: types.CURRENT_RELATIVE_HUMIDITY_CTYPE,
|
|
||||||
onUpdate: null,
|
|
||||||
onRead: function(callback) {
|
|
||||||
that.getCurrentRelativeHumidity(function(currentRelativeHumidity){
|
|
||||||
callback(currentRelativeHumidity);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
perms: ["pr","ev"],
|
|
||||||
format: "int",
|
|
||||||
initialValue: 0,
|
|
||||||
supportEvents: false,
|
|
||||||
supportBonjour: false,
|
|
||||||
manfDescription: "Humidity",
|
|
||||||
}]
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports.accessory = NestThermostatAccessory;
|
module.exports.accessory = NestThermostatAccessory;
|
||||||
module.exports.platform = NestPlatform;
|
module.exports.platform = NestPlatform;
|
||||||
|
|||||||
Reference in New Issue
Block a user