1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 15:18:16 +00:00

And now again

This commit is contained in:
Jordan Zucker 2025-02-13 14:30:09 -08:00
parent 66fa08264c
commit ce3d2602c0

View File

@ -883,13 +883,31 @@ void PrometheusHandler::climate_row_(AsyncResponseStream *stream, climate::Clima
stream->print(F("1.0"));
stream->print(F("\n"));
const auto traits = obj->get_traits();
// Now see if position is supported
// Now see if traits is supported
if (traits.get_supports_current_temperature()) {
std::string current_temp = "current_temperature";
int8_t current_accuracy = traits.get_current_temperature_accuracy_decimals();
auto current_temp_value = value_accuracy_to_string(obj->current_temperature, current_accuracy);
climate_mode_row_(stream, obj, area, node, friendly_name, current_temp, current_temp_value);
}
if (traits.get_supports_target_temperature()) {
std::string target_temp = "target_temperature";
int8_t target_accuracy = traits.get_target_temperature_accuracy_decimals();
auto target_temp_value = value_accuracy_to_string(obj->target_temperature, target_accuracy);
climate_mode_row_(stream, obj, area, node, friendly_name, target_temp, target_temp_value);
}
if (traits.get_supports_current_humidity()) {
std::string current_hum = "current_humidity";
int8_t current_accuracy = traits.get_current_humidity_accuracy_decimals();
auto current_hum_value = value_accuracy_to_string(obj->current_humidity, current_accuracy);
climate_mode_row_(stream, obj, area, node, friendly_name, current_hum, current_hum_value);
}
if (traits.get_supports_target_humidity()) {
std::string target_hum = "target_humidity";
int8_t target_accuracy = traits.get_target_humidity_accuracy_decimals();
auto target_hum_value = value_accuracy_to_string(obj->target_humidity, target_accuracy);
climate_mode_row_(stream, obj, area, node, friendly_name, target_hum, target_hum_value);
}
}
#endif