diff --git a/esphome/components/prometheus/prometheus_handler.cpp b/esphome/components/prometheus/prometheus_handler.cpp index 66b44ed174..9e998c1c77 100644 --- a/esphome/components/prometheus/prometheus_handler.cpp +++ b/esphome/components/prometheus/prometheus_handler.cpp @@ -905,11 +905,21 @@ void PrometheusHandler::climate_row_(AsyncResponseStream *stream, climate::Clima auto min_temp_value = value_accuracy_to_string(traits.get_visual_min_temperature(), target_accuracy); climate_value_row_(stream, obj, area, node, friendly_name, min_temp, min_temp_value); // now check optional things - if (traits.get_supports_current_temperature()) { + if (traits.get_supports_current_temperature() && !std::isnan(obj->current_temperature)) { std::string current_temp = "current_temperature"; auto current_temp_value = value_accuracy_to_string(obj->current_temperature, current_accuracy); climate_value_row_(stream, obj, area, node, friendly_name, current_temp, current_temp_value); } + if (traits.get_supports_current_humidity() && !std::isnan(obj->current_humidity)) { + std::string current_humidity = "current_humidity"; + auto current_humidity_value = value_accuracy_to_string(obj->current_humidity, 0); + climate_value_row_(stream, obj, area, node, friendly_name, current_humidity, current_humidity_value); + } + if (traits.get_supports_target_humidity() && !std::isnan(obj->target_humidity)) { + std::string target_humidity = "target_humidity"; + auto target_humidity_value = value_accuracy_to_string(obj->target_humidity, 0); + climate_value_row_(stream, obj, area, node, friendly_name, target_humidity, target_humidity_value); + } if (traits.get_supports_two_point_target_temperature()) { std::string target_temp_low = "target_temperature_low"; auto target_temp_low_value = value_accuracy_to_string(obj->target_temperature_low, target_accuracy); @@ -923,9 +933,24 @@ void PrometheusHandler::climate_row_(AsyncResponseStream *stream, climate::Clima climate_value_row_(stream, obj, area, node, friendly_name, target_temp, target_temp_value); } if (traits.get_supports_action()) { - std::string climate_action_category = "action"; - auto climate_action_value = climate::climate_action_to_string(obj->action); - climate_setting_row_(stream, obj, area, node, friendly_name, climate_action_category, climate_action_value); + std::string climate_trait_category = "action"; + auto climate_trait_value = climate::climate_action_to_string(obj->action); + climate_setting_row_(stream, obj, area, node, friendly_name, climate_trait_category, climate_trait_value); + } + if (traits.get_supports_fan_modes() && obj->fan_mode.has_value()) { + std::string climate_trait_category = "fan_mode"; + auto climate_trait_value = climate::climate_fan_mode_to_string(obj->fan_mode.value()); + climate_setting_row_(stream, obj, area, node, friendly_name, climate_trait_category, climate_trait_value); + } + if (traits.get_supports_presets() && obj->preset.has_value()) { + std::string climate_trait_category = "preset"; + auto climate_trait_value = climate::climate_preset_to_string(obj->preset.value()); + climate_setting_row_(stream, obj, area, node, friendly_name, climate_trait_category, climate_trait_value); + } + if (traits.get_supports_swing_modes()) { + std::string climate_trait_category = "swing_mode"; + auto climate_trait_value = climate::climate_swing_mode_to_string(obj->swing_mode); + climate_setting_row_(stream, obj, area, node, friendly_name, climate_trait_category, climate_trait_value); } } #endif