7static constexpr uint8_t HAIER_TUNDRA_FRAME_SIZE = 13;
13static constexpr IRCode MODES[] PROGMEM = {
18static constexpr IRCode FANS[] PROGMEM = {
36 PUBLISH_STATE(this->quiet_mode_switch_,
false);
37 PUBLISH_STATE(this->turbo_mode_switch_,
false);
44 const uint8_t frame[HAIER_TUNDRA_FRAME_SIZE] = {
48 static_cast<uint8_t
>(this->
health_() << 1),
49 static_cast<uint8_t
>(this->
power_() << 6),
51 static_cast<uint8_t
>(this->
quiet_() << 7 | this->
turbo_() << 6),
52 static_cast<uint8_t
>(to_ir_code(MODES, this->
mode, HAIER_MODE_AUTO) << 5),
55 static_cast<uint8_t
>((button == HAIER_BUTTON_SELF_CLEAN ? 1 : 0) << 4),
66 return (uint8_t) roundf(clamp<float>(this->
target_temperature, HAIER_TEMP_MIN, HAIER_TEMP_MAX)) - HAIER_TEMP_MIN;
71 return HAIER_SWING_V_OFF;
76 return HAIER_SWING_V_AUTO;
79 return HAIER_SWING_V_1BOT;
81 return HAIER_SWING_V_1TOP;
89 return HAIER_SWING_H_AUTO;
91 return HAIER_SWING_H_MIDDLE;
105 if (haier.has_value()) {
113 if (haier.
data.
size() != HAIER_TUNDRA_FRAME_SIZE || haier.
data[0] != this->unit_) {
127 PUBLISH_STATE(this->health_mode_switch_, this->
health_mode_);
128 PUBLISH_STATE(this->quiet_mode_switch_, this->
quiet_mode_);
129 PUBLISH_STATE(this->turbo_mode_switch_, this->
turbo_mode_);
140 if (swing_v == HAIER_SWING_V_AUTO) {
141 if (swing_h == HAIER_SWING_H_AUTO) {
146 }
else if (swing_h == HAIER_SWING_H_AUTO) {
165 PUBLISH_STATE(this->turbo_mode_switch_,
false);
172 this->
transmit_(HAIER_BUTTON_TURBO_QUIET);
179 PUBLISH_STATE(this->quiet_mode_switch_,
false);
186 this->
transmit_(HAIER_BUTTON_TURBO_QUIET);
197 this->
transmit_(HAIER_BUTTON_SELF_CLEAN);
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.
void publish_state()
Publish the state of the climate device, to be called from integrations.
void transmit_(uint8_t button)
void set_quiet_mode(bool quiet, bool transmit=true)
float get_temperature_(uint8_t temp)
climate::ClimateSwingMode get_swing_mode_(uint8_t swing_v, uint8_t swing_h)
bool on_haier_(const remote_base::HaierData &haier)
void set_turbo_mode(bool turbo, bool transmit=true)
void set_health_mode(bool health, bool transmit=true)
void transmit_state() override
uint8_t horizontal_swing_()
bool on_receive(remote_base::RemoteReceiveData data) override
uint8_t vertical_swing_()
void encode(RemoteTransmitData *dst, const HaierData &data)
optional< HaierData > decode(RemoteReceiveData src)
RemoteTransmitterBase * transmitter_
T from_ir_code(const IRCode(&table)[N], uint8_t code, T fallback)
The value for code, or fallback when the table has no such code; pass the current state to keep it.
uint8_t to_ir_code(const IRCode(&table)[N], uint8_t value, uint8_t fallback)
The code for value, or fallback when the table has no such value.
ClimateSwingMode
Enum for all modes a climate swing can be in NOTE: If adding values, update ClimateSwingModeMask in c...
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ 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_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.
One entry of a PROGMEM table that maps a climate enum value to the unit's code.
RemoteBytes< HAIER_MAX_DATA_BYTES > data