From 16deb55acbe826fc69a02f66da677ecdd6b9e7ce Mon Sep 17 00:00:00 2001 From: Ryan Wagoner Date: Wed, 18 Feb 2026 14:17:23 -0500 Subject: [PATCH] Add current_humidity to climate JSON when supported Include current_humidity field in climate state JSON when the climate device supports CLIMATE_SUPPORTS_CURRENT_HUMIDITY. --- esphome/components/web_server/web_server.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/esphome/components/web_server/web_server.cpp b/esphome/components/web_server/web_server.cpp index 47598456c3..f52c85eb5a 100644 --- a/esphome/components/web_server/web_server.cpp +++ b/esphome/components/web_server/web_server.cpp @@ -1594,6 +1594,11 @@ std::string WebServer::climate_json_(climate::Climate *obj, JsonDetail start_con ? "NA" : (value_accuracy_to_buf(temp_buf, obj->current_temperature, current_accuracy), temp_buf); } + if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY)) { + root[ESPHOME_F("current_humidity")] = + std::isnan(obj->current_humidity) ? "NA" + : (value_accuracy_to_buf(temp_buf, obj->current_humidity, 0), temp_buf); + } if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE | climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) { root[ESPHOME_F("target_temperature_low")] =