Closed emarrero closed 5 years ago
getDeviceProperties(ID) {
let p = new Promise((resolve, reject) => {
let url = "http://"+this.host+"/api/devices/"+ID;
request.get({
url: url,
headers : this.headers,
json: true
}, function(err, response, json) {
if (!err && response.statusCode == 200) {
if (json.type == "com.fibaro.temperatureSensor") {
if (json.properties.unit == "F") {
json.properties.unit = "C"
json.properties.value = (json.properties.value-32) * 5 / 9;
}
}
resolve(json.properties);
}
else {
reject(err);
}
});
});
return p;
}
![IMG_1285](https://user-images.githubusercontent.com/1309555/62968522-38cca780-bdd9-11e9-8e61-0f0fdbdd6c88.jpeg)
Are you able to create a PR?
I already submit to the Pull Request. I change the way of updating the temperature with a new variable in the config and only do the conversion when FibaroTemperatureUnit = "F" if the variable is "C" does not do the conversion.
ilcato, thank you very much for accepting the Pull request.
when I change Fibaro HC2 unit to F on control location panel. The homebridge-Fibaro-HC2 not validate if the unit is F or C.
The homebridge-Fibaro-HC2 on fibaro-api.ts getDevices() the result
I change the getDevices() to fix my problem
I need to change the pollerupdate.ts. the only problem with this change is that result do not include unit to validate if is F or C. I assuming that the value is in F because I change the HC2 to F. For other people this not going to work. if the Unit on HC2 it is in C the updates the value will be change unnecessary and broke the Temperature
ilcato, Can you implement a better solution in the next version? Thank you