Fix thermostat when using local sensor

Macros are not expanded in string constants, so the thermostat driver
never managed to obtain the current temperature from the local sensor
(SensorInputSet 1).
This commit is contained in:
Phil Dubach 2020-06-10 19:55:49 -07:00
parent 127254b283
commit 440219fd91

View File

@ -1331,7 +1331,7 @@ void ThermostatGetLocalSensor(uint8_t ctr_output) {
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.parseObject((const char*)mqtt_data);
if (root.success()) {
const char* value_c = root["THERMOSTAT_SENSOR_NAME"]["Temperature"];
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);
if ( (value >= -1000)