mirror of
https://github.com/esphome/esphome.git
synced 2026-03-01 02:14:19 -07:00
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.
This commit is contained in:
@@ -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")] =
|
||||
|
||||
Reference in New Issue
Block a user