diff --git a/esphome/components/climate_ir/climate_ir.cpp b/esphome/components/climate_ir/climate_ir.cpp index 0c128b2fcdf..8380e5e9d06 100644 --- a/esphome/components/climate_ir/climate_ir.cpp +++ b/esphome/components/climate_ir/climate_ir.cpp @@ -75,12 +75,12 @@ void ClimateIR::control(const climate::ClimateCall &call) { this->mode = *val; if (auto val = call.get_target_temperature(); val.has_value()) this->target_temperature = *val; - if (call.get_fan_mode().has_value()) - this->fan_mode = call.get_fan_mode(); + if (auto val = call.get_fan_mode(); val.has_value()) + this->fan_mode = val; if (auto val = call.get_swing_mode(); val.has_value()) this->swing_mode = *val; - if (call.get_preset().has_value()) - this->preset = call.get_preset(); + if (auto val = call.get_preset(); val.has_value()) + this->preset = val; this->transmit_state(); this->publish_state(); } diff --git a/esphome/components/esp32_rmt_led_strip/led_strip.cpp b/esphome/components/esp32_rmt_led_strip/led_strip.cpp index 24ef4c12566..f0d0a557d6f 100644 --- a/esphome/components/esp32_rmt_led_strip/led_strip.cpp +++ b/esphome/components/esp32_rmt_led_strip/led_strip.cpp @@ -162,7 +162,7 @@ void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bi void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) { // protect from refreshing too often uint32_t now = micros(); - if (this->max_refresh_rate_.value_or(0) != 0 && (now - this->last_refresh_) < this->max_refresh_rate_.value_or(0)) { + if (auto rate = this->max_refresh_rate_.value_or(0); rate != 0 && (now - this->last_refresh_) < rate) { // try again next loop iteration, so that this change won't get lost this->schedule_show(); return; diff --git a/esphome/components/haier/hon_climate.cpp b/esphome/components/haier/hon_climate.cpp index 7e51d62d061..1fa00857a5f 100644 --- a/esphome/components/haier/hon_climate.cpp +++ b/esphome/components/haier/hon_climate.cpp @@ -938,7 +938,7 @@ haier_protocol::HandlerError HonClimate::process_status_message_(const uint8_t * break; } should_publish = should_publish || (!old_fan_mode.has_value()) || - (old_fan_mode.value_or(CLIMATE_FAN_AUTO) != fan_mode.value_or(CLIMATE_FAN_AUTO)); + (old_fan_mode.value_or(CLIMATE_FAN_AUTO) != this->fan_mode.value_or(CLIMATE_FAN_AUTO)); } // Display status // should be before "Climate mode" because it is changing this->mode diff --git a/esphome/components/haier/smartair2_climate.cpp b/esphome/components/haier/smartair2_climate.cpp index 2101e44df69..e4806a9de0d 100644 --- a/esphome/components/haier/smartair2_climate.cpp +++ b/esphome/components/haier/smartair2_climate.cpp @@ -448,7 +448,7 @@ haier_protocol::HandlerError Smartair2Climate::process_status_message_(const uin break; } should_publish = should_publish || (!old_fan_mode.has_value()) || - (old_fan_mode.value_or(CLIMATE_FAN_AUTO) != fan_mode.value_or(CLIMATE_FAN_AUTO)); + (old_fan_mode.value_or(CLIMATE_FAN_AUTO) != this->fan_mode.value_or(CLIMATE_FAN_AUTO)); } // Display status // should be before "Climate mode" because it is changing this->mode diff --git a/esphome/components/sgp4x/sgp4x.h b/esphome/components/sgp4x/sgp4x.h index 52acaadbe83..89fa627c61c 100644 --- a/esphome/components/sgp4x/sgp4x.h +++ b/esphome/components/sgp4x/sgp4x.h @@ -81,14 +81,14 @@ class SGP4xComponent : public PollingComponent, public sensor::Sensor, public se void set_voc_algorithm_tuning(uint16_t index_offset, uint16_t learning_time_offset_hours, uint16_t learning_time_gain_hours, uint16_t gating_max_duration_minutes, uint16_t std_initial, uint16_t gain_factor) { - voc_tuning_params_ = GasTuning{ + this->voc_tuning_params_ = GasTuning{ index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, std_initial, gain_factor}; } void set_nox_algorithm_tuning(uint16_t index_offset, uint16_t learning_time_offset_hours, uint16_t learning_time_gain_hours, uint16_t gating_max_duration_minutes, uint16_t gain_factor) { - nox_tuning_params_ = + this->nox_tuning_params_ = GasTuning{index_offset, learning_time_offset_hours, learning_time_gain_hours, gating_max_duration_minutes, 50, gain_factor}; }