3#if defined(USE_ARDUINO) || defined(USE_ESP32)
7#include <HeatpumpIRFactory.h>
16class IRSenderESPHome :
public IRSender {
20 void setFrequency(
int frequency)
override {
21 auto *data = this->transmit_.
get_data();
22 data->set_carrier_frequency(1000 *
frequency);
25 void space(
int space_length)
override {
27 auto *data = this->transmit_.
get_data();
28 data->space(space_length);
34 void mark(
int mark_length)
override {
35 auto *data = this->transmit_.
get_data();
36 data->mark(mark_length);
43static const char *
const TAG =
"heatpumpir.climate";
56 {
PROTOCOL_GREE, []() {
return new GreeGenericHeatpumpIR(); }},
106 ESP_LOGE(TAG,
"Invalid protocol");
128 uint8_t power_mode_cmd;
129 uint8_t operating_mode_cmd;
130 uint8_t temperature_cmd;
131 uint8_t fan_speed_cmd;
136 swing_v_cmd = VDIR_AUTO;
139 swing_v_cmd = VDIR_UP;
142 swing_v_cmd = VDIR_MUP;
145 swing_v_cmd = VDIR_MIDDLE;
148 swing_v_cmd = VDIR_MDOWN;
151 swing_v_cmd = VDIR_DOWN;
154 ESP_LOGE(TAG,
"Invalid default vertical direction");
158 swing_v_cmd = VDIR_SWING;
164 swing_h_cmd = HDIR_AUTO;
167 swing_h_cmd = HDIR_MIDDLE;
170 swing_h_cmd = HDIR_LEFT;
173 swing_h_cmd = HDIR_MLEFT;
176 swing_h_cmd = HDIR_MRIGHT;
179 swing_h_cmd = HDIR_RIGHT;
182 ESP_LOGE(TAG,
"Invalid default horizontal direction");
186 swing_h_cmd = HDIR_SWING;
191 fan_speed_cmd = FAN_2;
194 fan_speed_cmd = FAN_3;
197 fan_speed_cmd = FAN_4;
201 fan_speed_cmd = FAN_AUTO;
205 switch (this->
mode) {
207 power_mode_cmd = POWER_ON;
208 operating_mode_cmd = MODE_COOL;
211 power_mode_cmd = POWER_ON;
212 operating_mode_cmd = MODE_HEAT;
220 power_mode_cmd = POWER_ON;
221 operating_mode_cmd = MODE_AUTO;
224 power_mode_cmd = POWER_ON;
225 operating_mode_cmd = MODE_FAN;
228 power_mode_cmd = POWER_ON;
229 operating_mode_cmd = MODE_DRY;
233 power_mode_cmd = POWER_OFF;
234 operating_mode_cmd = MODE_AUTO;
241 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_
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
void add_on_state_callback(F &&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_HEAT_COOL
The climate device is set to heat/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