1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-01 15:41:52 +00:00
This commit is contained in:
J. Nick Koston
2025-10-30 19:02:45 -05:00
parent 952f6f5029
commit 41bd8951dc

View File

@@ -637,14 +637,14 @@ uint16_t APIConnection::try_send_climate_state(EntityBase *entity, APIConnection
} }
if (traits.get_supports_fan_modes() && climate->fan_mode.has_value()) if (traits.get_supports_fan_modes() && climate->fan_mode.has_value())
resp.fan_mode = static_cast<enums::ClimateFanMode>(climate->fan_mode.value()); resp.fan_mode = static_cast<enums::ClimateFanMode>(climate->fan_mode.value());
if (!traits.get_supported_custom_fan_modes().empty() && climate->custom_fan_mode.has_value()) { if (!traits.get_supported_custom_fan_modes().empty() && climate->custom_fan_mode != nullptr) {
resp.set_custom_fan_mode(StringRef(climate->custom_fan_mode.value())); resp.set_custom_fan_mode(StringRef(climate->custom_fan_mode));
} }
if (traits.get_supports_presets() && climate->preset.has_value()) { if (traits.get_supports_presets() && climate->preset.has_value()) {
resp.preset = static_cast<enums::ClimatePreset>(climate->preset.value()); resp.preset = static_cast<enums::ClimatePreset>(climate->preset.value());
} }
if (!traits.get_supported_custom_presets().empty() && climate->custom_preset.has_value()) { if (!traits.get_supported_custom_presets().empty() && climate->custom_preset != nullptr) {
resp.set_custom_preset(StringRef(climate->custom_preset.value())); resp.set_custom_preset(StringRef(climate->custom_preset));
} }
if (traits.get_supports_swing_modes()) if (traits.get_supports_swing_modes())
resp.swing_mode = static_cast<enums::ClimateSwingMode>(climate->swing_mode); resp.swing_mode = static_cast<enums::ClimateSwingMode>(climate->swing_mode);