ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
haier_tundra.h
Go to the documentation of this file.
1#pragma once
2
5
6#ifdef USE_SWITCH
8#endif
9
10namespace esphome::haier_tundra {
11
12// Byte 0 - Header value (Unit ID)
13enum Unit : uint8_t {
16};
17
18// Byte 1[7:4] - Temperature (˚C) 0x0..0xE
19static constexpr uint8_t HAIER_TEMP_MIN = 16;
20static constexpr uint8_t HAIER_TEMP_MAX = 30;
21
22// Byte 1[3:0] - Vertical Swing
23static constexpr uint8_t HAIER_SWING_V_OFF = 0x0; // Power off value; from Auto, stops at current position
24static constexpr uint8_t HAIER_SWING_V_2TOP = 0x1; // [|/ ]
25static constexpr uint8_t HAIER_SWING_V_1TOP = 0x2; // [| ] (Not available in Heat mode)
26static constexpr uint8_t HAIER_SWING_V_2BOT = 0x3; // [ //]
27static constexpr uint8_t HAIER_SWING_V_1BOT = 0xA; // [ /] (Heat mode only)
28static constexpr uint8_t HAIER_SWING_V_AUTO = 0xC;
29
30// Byte 2[7:5] - Horizontal Swing
31static constexpr uint8_t HAIER_SWING_H_MIDDLE = 0x0; // [ || ]
32static constexpr uint8_t HAIER_SWING_H_LEFT = 0x3; // [/ ]
33static constexpr uint8_t HAIER_SWING_H_MIDDLE_LEFT = 0x4; // [ | ]
34static constexpr uint8_t HAIER_SWING_H_MIDDLE_RIGHT = 0x5; // [ | ]
35static constexpr uint8_t HAIER_SWING_H_RIGHT = 0x6; // [ \]
36static constexpr uint8_t HAIER_SWING_H_AUTO = 0x7; // [/||\]
37
38// Byte 3[7:5] - Timer Mode
39static constexpr uint8_t HAIER_TIMER_MODE_DISABLED = 0x0;
40static constexpr uint8_t HAIER_TIMER_MODE_OFF = 0x1; // OFF
41static constexpr uint8_t HAIER_TIMER_MODE_ON = 0x2; // ON
42static constexpr uint8_t HAIER_TIMER_MODE_ON_OFF = 0x4; // ON → OFF
43static constexpr uint8_t HAIER_TIMER_MODE_OFF_ON = 0x5; // ON ← OFF
44
45// Byte 3[1] - Health
46// Byte 4[6] - Power
47
48// Byte 5[7:5] - Fan Speed
49static constexpr uint8_t HAIER_FAN_HIGH = 0x1;
50static constexpr uint8_t HAIER_FAN_MED = 0x2;
51static constexpr uint8_t HAIER_FAN_LOW = 0x3;
52static constexpr uint8_t HAIER_FAN_AUTO = 0x5;
53
54// Byte 5[4:0] - Timer Off Hours (0-23) 0x00..0x17
55// Byte 6[7] - Quiet Mode
56// Byte 6[6] - Turbo Mode
57// Byte 6[5:0] - Timer Off Minutes (0-59) 0x00..0x3B
58
59// Byte 7[7:5] - Mode
60static constexpr uint8_t HAIER_MODE_AUTO = 0x0;
61static constexpr uint8_t HAIER_MODE_COOL = 0x1;
62static constexpr uint8_t HAIER_MODE_DRY = 0x2;
63static constexpr uint8_t HAIER_MODE_HEAT = 0x4;
64static constexpr uint8_t HAIER_MODE_FAN = 0x6;
65
66// Byte 7[4:0] - Timer On Hours (0-23) 0x00..0x17
67// Byte 8[7] - Sleep Mode
68// Byte 8[5:0] - Timer On Minutes (0-59) 0x00..0x3B
69// Byte 10[4] - Self Clean
70
71// Byte 12 - Button
72static constexpr uint8_t HAIER_BUTTON_TEMP_UP = 0x00;
73static constexpr uint8_t HAIER_BUTTON_TEMP_DOWN = 0x01;
74static constexpr uint8_t HAIER_BUTTON_SWING_V = 0x02;
75static constexpr uint8_t HAIER_BUTTON_SWING_H = 0x03;
76static constexpr uint8_t HAIER_BUTTON_FAN_SPEED = 0x04;
77static constexpr uint8_t HAIER_BUTTON_POWER = 0x05;
78static constexpr uint8_t HAIER_BUTTON_MODE = 0x06;
79static constexpr uint8_t HAIER_BUTTON_HEALTH = 0x07;
80static constexpr uint8_t HAIER_BUTTON_TURBO_QUIET = 0x08;
81static constexpr uint8_t HAIER_BUTTON_SLEEP = 0x0B;
82static constexpr uint8_t HAIER_BUTTON_TIMER = 0x10;
83static constexpr uint8_t HAIER_BUTTON_LIGHT = 0x15;
84static constexpr uint8_t HAIER_BUTTON_SELF_CLEAN = 0x19;
85
86class HaierTundra final : public climate_ir::ClimateIR {
87 public:
95
96#ifdef USE_SWITCH
97 SUB_SWITCH(health_mode);
98 SUB_SWITCH(quiet_mode);
99 SUB_SWITCH(turbo_mode);
100#endif
101
102 void set_health_mode(bool health, bool transmit = true);
103 void set_quiet_mode(bool quiet, bool transmit = true);
104 void set_turbo_mode(bool turbo, bool transmit = true);
105
106 void toggle_light();
107 void start_self_clean();
108
109 protected:
110 // Transmit via IR the state of this climate controller.
111 void transmit_state() override;
112
113 void transmit_(uint8_t button);
114 uint8_t temperature_();
115 uint8_t vertical_swing_();
116 uint8_t horizontal_swing_();
117 uint8_t health_();
118 uint8_t power_();
119 uint8_t fan_speed_();
120 uint8_t quiet_();
121 uint8_t turbo_();
122 uint8_t operation_mode_();
123
124 // Handle received IR Buffer
125 bool on_receive(remote_base::RemoteReceiveData data) override;
126 bool on_haier_(const remote_base::HaierData &haier);
127
128 float get_temperature_(uint8_t temp);
129 climate::ClimateSwingMode get_swing_mode_(uint8_t swing_v, uint8_t swing_h);
130 climate::ClimateMode get_operation_mode_(uint8_t power, uint8_t mode);
132
134 bool health_mode_{false};
135 bool quiet_mode_{false};
136 bool turbo_mode_{false};
137};
138
139} // namespace esphome::haier_tundra
ClimateMode mode
The active mode of the climate device.
Definition climate.h:304
ClimateIR(float minimum_temperature, float maximum_temperature, float temperature_step=1.0f, bool supports_dry=false, bool supports_fan_only=false, climate::ClimateFanModeMask fan_modes=climate::ClimateFanModeMask(), climate::ClimateSwingModeMask swing_modes=climate::ClimateSwingModeMask(), climate::ClimatePresetMask presets=climate::ClimatePresetMask())
Definition climate_ir.h:25
void set_quiet_mode(bool quiet, bool transmit=true)
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)
climate::ClimateFanMode get_fan_speed_(uint8_t fan)
climate::ClimateMode get_operation_mode_(uint8_t power, uint8_t mode)
void set_health_mode(bool health, bool transmit=true)
bool on_receive(remote_base::RemoteReceiveData data) override
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.
ClimateMode
Enum for all modes a climate device can be in.
ClimateFanMode
NOTE: If adding values, update ClimateFanModeMask in climate_traits.h to use the new last value.
@ 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.