7#include "HeatpumpIRFactory.h"
13static const char *
const TAG =
"heatpumpir.climate";
26 {
PROTOCOL_GREE, []() {
return new GreeGenericHeatpumpIR(); }},
75 ESP_LOGE(TAG,
"Invalid protocol");
97 uint8_t power_mode_cmd;
98 uint8_t operating_mode_cmd;
99 uint8_t temperature_cmd;
100 uint8_t fan_speed_cmd;
105 swing_v_cmd = VDIR_AUTO;
108 swing_v_cmd = VDIR_UP;
111 swing_v_cmd = VDIR_MUP;
114 swing_v_cmd = VDIR_MIDDLE;
117 swing_v_cmd = VDIR_MDOWN;
120 swing_v_cmd = VDIR_DOWN;
123 ESP_LOGE(TAG,
"Invalid default vertical direction");
127 swing_v_cmd = VDIR_SWING;
133 swing_h_cmd = HDIR_AUTO;
136 swing_h_cmd = HDIR_MIDDLE;
139 swing_h_cmd = HDIR_LEFT;
142 swing_h_cmd = HDIR_MLEFT;
145 swing_h_cmd = HDIR_MRIGHT;
148 swing_h_cmd = HDIR_RIGHT;
151 ESP_LOGE(TAG,
"Invalid default horizontal direction");
155 swing_h_cmd = HDIR_SWING;
160 fan_speed_cmd = FAN_2;
163 fan_speed_cmd = FAN_3;
166 fan_speed_cmd = FAN_4;
170 fan_speed_cmd = FAN_AUTO;
174 switch (this->
mode) {
176 power_mode_cmd = POWER_ON;
177 operating_mode_cmd = MODE_COOL;
180 power_mode_cmd = POWER_ON;
181 operating_mode_cmd = MODE_HEAT;
184 power_mode_cmd = POWER_ON;
185 operating_mode_cmd = MODE_AUTO;
188 power_mode_cmd = POWER_ON;
189 operating_mode_cmd = MODE_FAN;
192 power_mode_cmd = POWER_ON;
193 operating_mode_cmd = MODE_DRY;
197 power_mode_cmd = POWER_OFF;
198 operating_mode_cmd = MODE_AUTO;
205 heatpump_ir_->send(esp_sender, power_mode_cmd, operating_mode_cmd, fan_speed_cmd, temperature_cmd, swing_v_cmd,
ClimateMode mode
The active mode of the climate device.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
float target_temperature
The target temperature of the climate device.
ClimateSwingMode swing_mode
The active swing mode of the climate device.
float current_temperature
The current temperature of the climate device, as reported from the integration.
void publish_state()
Publish the state of the climate device, to be called from integrations.
VerticalDirection default_vertical_direction_
void transmit_state() override
Transmit via IR the state of this climate controller.
HorizontalDirection default_horizontal_direction_
HeatpumpIR * heatpump_ir_
value_type value_or(U const &v) const
RemoteTransmitterBase * transmitter_
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
float state
This member variable stores the last state that has passed through all filters.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
@ CLIMATE_MODE_DRY
The climate device is set to dry/humidity mode.
@ CLIMATE_MODE_FAN_ONLY
The climate device only has the fan enabled, no heating or cooling is taking place.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_COOL
The climate device is set to cool to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
@ CLIMATE_MODE_AUTO
The climate device is adjusting the temperature dynamically.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
@ VERTICAL_DIRECTION_MIDDLE
@ VERTICAL_DIRECTION_MDOWN
@ VERTICAL_DIRECTION_AUTO
@ VERTICAL_DIRECTION_DOWN
const std::map< Protocol, std::function< HeatpumpIR *()> > PROTOCOL_CONSTRUCTOR_MAP
@ HORIZONTAL_DIRECTION_RIGHT
@ HORIZONTAL_DIRECTION_MIDDLE
@ HORIZONTAL_DIRECTION_MRIGHT
@ HORIZONTAL_DIRECTION_AUTO
@ HORIZONTAL_DIRECTION_MLEFT
@ HORIZONTAL_DIRECTION_LEFT
@ PROTOCOL_MITSUBISHI_HEAVY_ZMP
@ PROTOCOL_MITSUBISHI_HEAVY_ZM
@ PROTOCOL_MITSUBISHI_HEAVY_ZJ
@ PROTOCOL_SAMSUNG_AQV12MSAN
@ PROTOCOL_MITSUBISHI_MSC
@ PROTOCOL_MITSUBISHI_MSY
@ PROTOCOL_MITSUBISHI_HEAVY_FDTC
@ PROTOCOL_MITSUBISHI_SEZ
@ PROTOCOL_TOSHIBA_DAISEIKAI
@ PROTOCOL_PANASONIC_ALTDKE
Providing packet encoding functions for exchanging data with a remote host.
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)