fix min/max adaption

This commit is contained in:
MichaelDvP
2023-06-30 09:58:24 +02:00
parent 8b800ded21
commit 3efe16c840

View File

@@ -1657,8 +1657,7 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c
// check for value outside min/max range and adapt the limits to avoid HA complains // check for value outside min/max range and adapt the limits to avoid HA complains
// Should this also check for api output? // Should this also check for api output?
if ((output_target == OUTPUT_TARGET::MQTT) && (dv.min != 0 || dv.max != 0)) { if ((output_target == OUTPUT_TARGET::MQTT) && (dv.min != 0 || dv.max != 0)) {
if (json[name].is<float>() || json[name].is<int>()) { int v = Helpers::atoint(json[name]);
int v = json[name];
if (fahrenheit) { if (fahrenheit) {
v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C v = (v - (32 * (fahrenheit - 1))) / 1.8; // reset to °C
} }
@@ -1673,7 +1672,6 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c
} }
} }
} }
}
return has_values; return has_values;
} }