mirror of
https://github.com/esphome/esphome.git
synced 2025-01-24 05:14:29 +01:00
climate: Add features to generic Toshiba model (#3912)
Add fan speed modes, dry and fan-only operation modes. This reduce differences between generic and PT14111 models.
This commit is contained in:
parent
0c24d951ff
commit
cc45945fcf
2 changed files with 32 additions and 17 deletions
|
@ -124,9 +124,6 @@ void ToshibaClimate::setup() {
|
||||||
// Set supported modes & temperatures based on model
|
// Set supported modes & temperatures based on model
|
||||||
this->minimum_temperature_ = this->temperature_min_();
|
this->minimum_temperature_ = this->temperature_min_();
|
||||||
this->maximum_temperature_ = this->temperature_max_();
|
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_();
|
this->swing_modes_ = this->toshiba_swing_modes_();
|
||||||
// Never send nan to HA
|
// Never send nan to HA
|
||||||
if (std::isnan(this->target_temperature))
|
if (std::isnan(this->target_temperature))
|
||||||
|
@ -178,12 +175,39 @@ void ToshibaClimate::transmit_generic_() {
|
||||||
mode = TOSHIBA_MODE_COOL;
|
mode = TOSHIBA_MODE_COOL;
|
||||||
break;
|
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:
|
case climate::CLIMATE_MODE_HEAT_COOL:
|
||||||
default:
|
default:
|
||||||
mode = TOSHIBA_MODE_AUTO;
|
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
|
// Zero
|
||||||
message[7] = 0x00;
|
message[7] = 0x00;
|
||||||
|
|
|
@ -22,7 +22,10 @@ const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MAX = 86.0;
|
||||||
|
|
||||||
class ToshibaClimate : public climate_ir::ClimateIR {
|
class ToshibaClimate : public climate_ir::ClimateIR {
|
||||||
public:
|
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 setup() override;
|
||||||
void set_model(Model model) { this->model_ = model; }
|
void set_model(Model model) { this->model_ = model; }
|
||||||
|
@ -46,18 +49,6 @@ class ToshibaClimate : public climate_ir::ClimateIR {
|
||||||
float temperature_max_() {
|
float temperature_max_() {
|
||||||
return (this->model_ == MODEL_GENERIC) ? TOSHIBA_GENERIC_TEMP_C_MAX : TOSHIBA_RAC_PT1411HWRU_TEMP_C_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<climate::ClimateFanMode> toshiba_fan_modes_() {
|
|
||||||
return (this->model_ == MODEL_GENERIC)
|
|
||||||
? std::set<climate::ClimateFanMode>{}
|
|
||||||
: std::set<climate::ClimateFanMode>{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW,
|
|
||||||
climate::CLIMATE_FAN_MEDIUM, climate::CLIMATE_FAN_HIGH};
|
|
||||||
}
|
|
||||||
std::set<climate::ClimateSwingMode> toshiba_swing_modes_() {
|
std::set<climate::ClimateSwingMode> toshiba_swing_modes_() {
|
||||||
return (this->model_ == MODEL_GENERIC)
|
return (this->model_ == MODEL_GENERIC)
|
||||||
? std::set<climate::ClimateSwingMode>{}
|
? std::set<climate::ClimateSwingMode>{}
|
||||||
|
|
Loading…
Add table
Reference in a new issue