2019-05-27 21:09:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-10-17 21:01:02 +02:00
|
|
|
#include "esphome/components/climate_ir/climate_ir.h"
|
2019-05-27 21:09:16 +02:00
|
|
|
|
|
|
|
namespace esphome {
|
|
|
|
namespace coolix {
|
|
|
|
|
2019-10-17 21:01:02 +02:00
|
|
|
// Temperature
|
|
|
|
const uint8_t COOLIX_TEMP_MIN = 17; // Celsius
|
|
|
|
const uint8_t COOLIX_TEMP_MAX = 30; // Celsius
|
2019-09-09 03:14:39 +02:00
|
|
|
|
2019-10-25 11:32:31 +02:00
|
|
|
class CoolixClimate : public climate_ir::ClimateIR {
|
2019-05-27 21:09:16 +02:00
|
|
|
public:
|
2019-11-16 16:34:11 +01:00
|
|
|
CoolixClimate()
|
|
|
|
: climate_ir::ClimateIR(COOLIX_TEMP_MIN, COOLIX_TEMP_MAX, 1.0f, true, true,
|
|
|
|
{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM,
|
|
|
|
climate::CLIMATE_FAN_HIGH},
|
|
|
|
{climate::CLIMATE_SWING_OFF, climate::CLIMATE_SWING_VERTICAL}) {}
|
|
|
|
|
|
|
|
/// Override control to change settings of the climate device.
|
|
|
|
void control(const climate::ClimateCall &call) override {
|
|
|
|
send_swing_cmd_ = call.get_swing_mode().has_value();
|
|
|
|
// swing resets after unit powered off
|
|
|
|
if (call.get_mode().has_value() && *call.get_mode() == climate::CLIMATE_MODE_OFF)
|
|
|
|
this->swing_mode = climate::CLIMATE_SWING_OFF;
|
|
|
|
climate_ir::ClimateIR::control(call);
|
|
|
|
}
|
2019-05-27 21:09:16 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/// Transmit via IR the state of this climate controller.
|
2019-10-17 21:01:02 +02:00
|
|
|
void transmit_state() override;
|
|
|
|
/// Handle received IR Buffer
|
|
|
|
bool on_receive(remote_base::RemoteReceiveData data) override;
|
2019-11-16 16:34:11 +01:00
|
|
|
|
|
|
|
bool send_swing_cmd_{false};
|
2019-05-27 21:09:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace coolix
|
|
|
|
} // namespace esphome
|