mirror of
https://github.com/esphome/esphome.git
synced 2025-10-31 23:21:54 +00:00
simplify
This commit is contained in:
@@ -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())
|
||||
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()) {
|
||||
resp.set_custom_fan_mode(StringRef(climate->custom_fan_mode.value()));
|
||||
if (!traits.get_supported_custom_fan_modes().empty() && climate->custom_fan_mode != nullptr) {
|
||||
resp.set_custom_fan_mode(StringRef(climate->custom_fan_mode));
|
||||
}
|
||||
if (traits.get_supports_presets() && climate->preset.has_value()) {
|
||||
resp.preset = static_cast<enums::ClimatePreset>(climate->preset.value());
|
||||
}
|
||||
if (!traits.get_supported_custom_presets().empty() && climate->custom_preset.has_value()) {
|
||||
resp.set_custom_preset(StringRef(climate->custom_preset.value()));
|
||||
if (!traits.get_supported_custom_presets().empty() && climate->custom_preset != nullptr) {
|
||||
resp.set_custom_preset(StringRef(climate->custom_preset));
|
||||
}
|
||||
if (traits.get_supports_swing_modes())
|
||||
resp.swing_mode = static_cast<enums::ClimateSwingMode>(climate->swing_mode);
|
||||
|
||||
Reference in New Issue
Block a user