mirror of
https://github.com/esphome/esphome.git
synced 2026-03-01 02:14:19 -07:00
Default fan_mode to AUTO when supported but unset
Empty string is not a valid fan_mode value. When the climate supports fan modes but no value has been set yet, default to AUTO.
This commit is contained in:
@@ -1564,7 +1564,8 @@ std::string WebServer::climate_json_(climate::Climate *obj, JsonDetail start_con
|
||||
}
|
||||
if (traits.get_supports_fan_modes()) {
|
||||
root[ESPHOME_F("fan_mode")] =
|
||||
obj->fan_mode.has_value() ? PSTR_LOCAL(climate_fan_mode_to_string(obj->fan_mode.value())) : "";
|
||||
obj->fan_mode.has_value() ? PSTR_LOCAL(climate_fan_mode_to_string(obj->fan_mode.value()))
|
||||
: PSTR_LOCAL(climate_fan_mode_to_string(climate::CLIMATE_FAN_AUTO));
|
||||
}
|
||||
if (!traits.get_supported_custom_fan_modes().empty()) {
|
||||
if (obj->has_custom_fan_mode()) {
|
||||
|
||||
Reference in New Issue
Block a user