diff --git a/esphome/components/toshiba/toshiba.cpp b/esphome/components/toshiba/toshiba.cpp index 104e885aab..a070ccceb2 100644 --- a/esphome/components/toshiba/toshiba.cpp +++ b/esphome/components/toshiba/toshiba.cpp @@ -124,9 +124,6 @@ void ToshibaClimate::setup() { // Set supported modes & temperatures based on model this->minimum_temperature_ = this->temperature_min_(); this->maximum_temperature_ = this->temperature_max_(); - this->supports_dry_ = this->toshiba_supports_dry_(); - this->supports_fan_only_ = this->toshiba_supports_fan_only_(); - this->fan_modes_ = this->toshiba_fan_modes_(); this->swing_modes_ = this->toshiba_swing_modes_(); // Never send nan to HA if (std::isnan(this->target_temperature)) @@ -178,12 +175,39 @@ void ToshibaClimate::transmit_generic_() { mode = TOSHIBA_MODE_COOL; break; + case climate::CLIMATE_MODE_DRY: + mode = TOSHIBA_MODE_DRY; + break; + + case climate::CLIMATE_MODE_FAN_ONLY: + mode = TOSHIBA_MODE_FAN_ONLY; + break; + case climate::CLIMATE_MODE_HEAT_COOL: default: mode = TOSHIBA_MODE_AUTO; } - message[6] |= mode | TOSHIBA_FAN_SPEED_AUTO; + uint8_t fan; + switch (this->fan_mode.value()) { + case climate::CLIMATE_FAN_LOW: + fan = TOSHIBA_FAN_SPEED_1; + break; + + case climate::CLIMATE_FAN_MEDIUM: + fan = TOSHIBA_FAN_SPEED_3; + break; + + case climate::CLIMATE_FAN_HIGH: + fan = TOSHIBA_FAN_SPEED_5; + break; + + case climate::CLIMATE_FAN_AUTO: + default: + fan = TOSHIBA_FAN_SPEED_AUTO; + break; + } + message[6] = fan | mode; // Zero message[7] = 0x00; diff --git a/esphome/components/toshiba/toshiba.h b/esphome/components/toshiba/toshiba.h index 36e8760169..729548e747 100644 --- a/esphome/components/toshiba/toshiba.h +++ b/esphome/components/toshiba/toshiba.h @@ -22,7 +22,10 @@ const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MAX = 86.0; class ToshibaClimate : public climate_ir::ClimateIR { public: - ToshibaClimate() : climate_ir::ClimateIR(TOSHIBA_GENERIC_TEMP_C_MIN, TOSHIBA_GENERIC_TEMP_C_MAX, 1.0f) {} + ToshibaClimate() + : climate_ir::ClimateIR(TOSHIBA_GENERIC_TEMP_C_MIN, TOSHIBA_GENERIC_TEMP_C_MAX, 1.0f, true, true, + {climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM, + climate::CLIMATE_FAN_HIGH}) {} void setup() override; void set_model(Model model) { this->model_ = model; } @@ -46,18 +49,6 @@ class ToshibaClimate : public climate_ir::ClimateIR { float temperature_max_() { return (this->model_ == MODEL_GENERIC) ? TOSHIBA_GENERIC_TEMP_C_MAX : TOSHIBA_RAC_PT1411HWRU_TEMP_C_MAX; } - bool toshiba_supports_dry_() { - return ((this->model_ == MODEL_RAC_PT1411HWRU_C) || (this->model_ == MODEL_RAC_PT1411HWRU_F)); - } - bool toshiba_supports_fan_only_() { - return ((this->model_ == MODEL_RAC_PT1411HWRU_C) || (this->model_ == MODEL_RAC_PT1411HWRU_F)); - } - std::set toshiba_fan_modes_() { - return (this->model_ == MODEL_GENERIC) - ? std::set{} - : std::set{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, - climate::CLIMATE_FAN_MEDIUM, climate::CLIMATE_FAN_HIGH}; - } std::set toshiba_swing_modes_() { return (this->model_ == MODEL_GENERIC) ? std::set{}