mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-05 20:38:27 +02:00
Climate whirlpool (#1029)
* wip * transmitter ready * climate.whirlpool receiver implemented (#971) * receiver implemented * Support for two models of temp ranges * temperature type and lint * more lint Co-authored-by: Guillermo Ruffino <glm.net@gmail.com> * add test * not mess line endings Co-authored-by: mmanza <40872469+mmanza@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d447548893
commit
8040e3cf95
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/components/climate_ir/climate_ir.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace whirlpool {
|
||||
|
||||
/// Simple enum to represent models.
|
||||
enum Model {
|
||||
MODEL_DG11J1_3A = 0, /// Temperature range is from 18 to 32
|
||||
MODEL_DG11J1_91 = 1, /// Temperature range is from 16 to 30
|
||||
};
|
||||
|
||||
// Temperature
|
||||
const float WHIRLPOOL_DG11J1_3A_TEMP_MAX = 32.0;
|
||||
const float WHIRLPOOL_DG11J1_3A_TEMP_MIN = 18.0;
|
||||
const float WHIRLPOOL_DG11J1_91_TEMP_MAX = 30.0;
|
||||
const float WHIRLPOOL_DG11J1_91_TEMP_MIN = 16.0;
|
||||
|
||||
class WhirlpoolClimate : public climate_ir::ClimateIR {
|
||||
public:
|
||||
WhirlpoolClimate()
|
||||
: climate_ir::ClimateIR(temperature_min_(), temperature_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}) {}
|
||||
|
||||
void setup() override {
|
||||
climate_ir::ClimateIR::setup();
|
||||
|
||||
this->powered_on_assumed_ = this->mode != climate::CLIMATE_MODE_OFF;
|
||||
}
|
||||
|
||||
/// 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();
|
||||
climate_ir::ClimateIR::control(call);
|
||||
}
|
||||
|
||||
void set_model(Model model) { this->model_ = model; }
|
||||
|
||||
protected:
|
||||
/// Transmit via IR the state of this climate controller.
|
||||
void transmit_state() override;
|
||||
/// Handle received IR Buffer
|
||||
bool on_receive(remote_base::RemoteReceiveData data) override;
|
||||
|
||||
// used to track when to send the power toggle command
|
||||
bool powered_on_assumed_;
|
||||
|
||||
bool send_swing_cmd_{false};
|
||||
Model model_;
|
||||
|
||||
float temperature_min_() {
|
||||
return (model_ == MODEL_DG11J1_3A) ? WHIRLPOOL_DG11J1_3A_TEMP_MIN : WHIRLPOOL_DG11J1_91_TEMP_MIN;
|
||||
}
|
||||
float temperature_max_() {
|
||||
return (model_ == MODEL_DG11J1_3A) ? WHIRLPOOL_DG11J1_3A_TEMP_MAX : WHIRLPOOL_DG11J1_91_TEMP_MAX;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace whirlpool
|
||||
} // namespace esphome
|
||||
Reference in New Issue
Block a user