Merge pull request #8895 from arijav/development

Bugfix local temperature sensor in fahrenheit for Thermostat driver
This commit is contained in:
Theo Arends 2020-07-14 11:27:40 +02:00 committed by GitHub
commit 7507d51ab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -1333,7 +1333,13 @@ void ThermostatGetLocalSensor(uint8_t ctr_output) {
if (root.success()) {
const char* value_c = root[THERMOSTAT_SENSOR_NAME]["Temperature"];
if (value_c != NULL && strlen(value_c) > 0 && (isdigit(value_c[0]) || (value_c[0] == '-' && isdigit(value_c[1])) ) ) {
int16_t value = (int16_t)(CharToFloat(value_c) * 10);
int16_t value;
if (Thermostat[ctr_output].status.temp_format == TEMP_FAHRENHEIT) {
value = (int16_t)ThermostatFahrenheitToCelsius((int32_t)(CharToFloat(value_c) * 10), TEMP_CONV_ABSOLUTE);
}
else {
value = (int16_t)(CharToFloat(value_c) * 10);
}
if ( (value >= -1000)
&& (value <= 1000)
&& (Thermostat[ctr_output].status.sensor_type == SENSOR_LOCAL)) {