mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 00:51:49 +00:00 
			
		
		
		
	simplify
This commit is contained in:
		@@ -144,8 +144,7 @@ void BedJetClimate::control(const ClimateCall &call) {
 | 
			
		||||
 | 
			
		||||
      if (result) {
 | 
			
		||||
        this->mode = CLIMATE_MODE_HEAT;
 | 
			
		||||
        this->preset = CLIMATE_PRESET_BOOST;
 | 
			
		||||
        this->clear_custom_preset_();
 | 
			
		||||
        this->set_preset_(CLIMATE_PRESET_BOOST);
 | 
			
		||||
      }
 | 
			
		||||
    } else if (preset == CLIMATE_PRESET_NONE && this->preset.has_value()) {
 | 
			
		||||
      if (this->mode == CLIMATE_MODE_HEAT && this->preset == CLIMATE_PRESET_BOOST) {
 | 
			
		||||
@@ -259,7 +258,6 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
 | 
			
		||||
    case MODE_HEAT:
 | 
			
		||||
      this->mode = CLIMATE_MODE_HEAT;
 | 
			
		||||
      this->action = CLIMATE_ACTION_HEATING;
 | 
			
		||||
      this->preset.reset();
 | 
			
		||||
      if (this->heating_mode_ == HEAT_MODE_EXTENDED) {
 | 
			
		||||
        this->set_custom_preset_("LTD HT");
 | 
			
		||||
      } else {
 | 
			
		||||
@@ -270,7 +268,6 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
 | 
			
		||||
    case MODE_EXTHT:
 | 
			
		||||
      this->mode = CLIMATE_MODE_HEAT;
 | 
			
		||||
      this->action = CLIMATE_ACTION_HEATING;
 | 
			
		||||
      this->preset.reset();
 | 
			
		||||
      if (this->heating_mode_ == HEAT_MODE_EXTENDED) {
 | 
			
		||||
        this->clear_custom_preset_();
 | 
			
		||||
      } else {
 | 
			
		||||
@@ -293,8 +290,7 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case MODE_TURBO:
 | 
			
		||||
      this->preset = CLIMATE_PRESET_BOOST;
 | 
			
		||||
      this->clear_custom_preset_();
 | 
			
		||||
      this->set_preset_(CLIMATE_PRESET_BOOST);
 | 
			
		||||
      this->mode = CLIMATE_MODE_HEAT;
 | 
			
		||||
      this->action = CLIMATE_ACTION_HEATING;
 | 
			
		||||
      break;
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ class DemoClimate : public climate::Climate, public Component {
 | 
			
		||||
        this->mode = climate::CLIMATE_MODE_HEAT_COOL;
 | 
			
		||||
        this->set_custom_fan_mode_("Auto Low");
 | 
			
		||||
        this->swing_mode = climate::CLIMATE_SWING_HORIZONTAL;
 | 
			
		||||
        this->preset = climate::CLIMATE_PRESET_AWAY;
 | 
			
		||||
        this->set_preset_(climate::CLIMATE_PRESET_AWAY);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
    this->publish_state();
 | 
			
		||||
 
 | 
			
		||||
@@ -1162,7 +1162,7 @@ void ThermostatClimate::change_preset_(climate::ClimatePreset preset) {
 | 
			
		||||
        this->preset.value() != preset) {
 | 
			
		||||
      // Fire any preset changed trigger if defined
 | 
			
		||||
      Trigger<> *trig = this->preset_change_trigger_;
 | 
			
		||||
      this->preset = preset;
 | 
			
		||||
      this->set_preset_(preset);
 | 
			
		||||
      if (trig != nullptr) {
 | 
			
		||||
        trig->trigger();
 | 
			
		||||
      }
 | 
			
		||||
@@ -1172,8 +1172,6 @@ void ThermostatClimate::change_preset_(climate::ClimatePreset preset) {
 | 
			
		||||
    } else {
 | 
			
		||||
      ESP_LOGI(TAG, "No changes required to apply preset %s", LOG_STR_ARG(climate::climate_preset_to_string(preset)));
 | 
			
		||||
    }
 | 
			
		||||
    this->clear_custom_preset_();
 | 
			
		||||
    this->preset = preset;
 | 
			
		||||
  } else {
 | 
			
		||||
    ESP_LOGW(TAG, "Preset %s not configured; ignoring", LOG_STR_ARG(climate::climate_preset_to_string(preset)));
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user