From ce3d2602c0b545575d1cb39f51a0ddc7095fcc44 Mon Sep 17 00:00:00 2001 From: Jordan Zucker Date: Thu, 13 Feb 2025 14:30:09 -0800 Subject: [PATCH] And now again --- .../prometheus/prometheus_handler.cpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/esphome/components/prometheus/prometheus_handler.cpp b/esphome/components/prometheus/prometheus_handler.cpp index f3123edea8..05c46d95fd 100644 --- a/esphome/components/prometheus/prometheus_handler.cpp +++ b/esphome/components/prometheus/prometheus_handler.cpp @@ -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