Skip to content

Commit

Permalink
Move set_supported_swing_modes to climate_ir.h
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz committed Jul 12, 2021
1 parent 4b0fc2c commit 531f5f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 15 additions & 0 deletions esphome/components/climate_ir/climate_ir.h
Expand Up @@ -41,6 +41,21 @@ class ClimateIR : public climate::Climate, public Component, public remote_base:
void set_supports_heat(bool supports_heat) { this->supports_heat_ = supports_heat; }
void set_sensor(sensor::Sensor *sensor) { this->sensor_ = sensor; }

void set_supported_swing_modes(bool horizontal, bool vertical, bool both) {
this->swing_modes_.clear();
if (horizontal || vertical || both)
this->swing_modes_.insert(climate::CLIMATE_SWING_OFF);

if (horizontal)
this->swing_modes_.insert(climate::CLIMATE_SWING_HORIZONTAL);

if (vertical)
this->swing_modes_.insert(climate::CLIMATE_SWING_VERTICAL);

if (both)
this->swing_modes_.insert(climate::CLIMATE_SWING_BOTH);
}

protected:
float minimum_temperature_, maximum_temperature_, temperature_step_;

Expand Down
14 changes: 0 additions & 14 deletions esphome/components/panasonic/panasonic.h
Expand Up @@ -16,20 +16,6 @@ class PanasonicClimate : public climate_ir::ClimateIR {
{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM,
climate::CLIMATE_FAN_HIGH}) {}

void set_supported_swing_modes(bool horizontal, bool vertical, bool both) {
if (horizontal || vertical)
this->swing_modes_.insert(climate::CLIMATE_SWING_OFF);

if (horizontal)
this->swing_modes_.insert(climate::CLIMATE_SWING_HORIZONTAL);

if (vertical)
this->swing_modes_.insert(climate::CLIMATE_SWING_VERTICAL);

if (both)
this->swing_modes_.insert(climate::CLIMATE_SWING_BOTH);
}

protected:
/// Transmit via IR the state of this climate controller.
void transmit_state() override;
Expand Down

0 comments on commit 531f5f7

Please sign in to comment.