ESPHome  2024.12.2
zhlt01.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 /***********************************************************************************
6  * SOURCE
7  ***********************************************************************************
8  * The IR codes and the functional description below were taken from
9  * 'arduino-heatpumpir/ZHLT01HeatpumpIR.h' as can be found on GitHub
10  * https://github.com/ToniA/arduino-heatpumpir/blob/master/ZHLT01HeatpumpIR.h
11  *
12  ************************************************************************************
13  * Airconditional remote control encoder for:
14  *
15  * ZH/LT-01 Remote control https://www.google.com/search?q=zh/lt-01
16  *
17  * The ZH/LT-01 remote control is used for many locally branded Split
18  * airconditioners, so it is better to name this protocol by the name of the
19  * REMOTE rather then the name of the Airconditioner. For this project I used
20  * a 2014 model Eurom-airconditioner, which is Dutch-branded and sold in
21  * the Netherlands at Hornbach.
22  *
23  * For airco-brands:
24  * Eurom
25  * Chigo
26  * Tristar
27  * Tecnomaster
28  * Elgin
29  * Geant
30  * Tekno
31  * Topair
32  * Proma
33  * Sumikura
34  * JBS
35  * Turbo Air
36  * Nakatomy
37  * Celestial Air
38  * Ager
39  * Blueway
40  * Airlux
41  * Etc.
42  *
43  ***********************************************************************************
44  * SUMMARY FUNCTIONAL DESCRIPTION
45  ***********************************************************************************
46  * The remote sends a 12 Byte message which contains all possible settings every
47  * time.
48  *
49  * Byte 11 (and 10) contain the remote control identifier and are always 0xD5 and
50  * 0x2A respectively for the ZH/LT-01 remote control.
51  * Every UNeven Byte (01,03,05,07 and 09) holds command data
52  * Every EVEN Byte (00,02,04,06,08 and 10) holds a checksum of the corresponding
53  * command-, or identifier-byte by _inverting_ the bits, for example:
54  *
55  * The identifier byte[11] = 0xD5 = B1101 0101
56  * The checksum byte[10] = 0x2A = B0010 1010
57  *
58  * So, you can check the message by:
59  * - inverting the bits of the checksum byte with the corresponding command-, or
60  * identifier byte, they should be the same, or
61  * - Summing up the checksum byte and the corresponding command-, or identifier byte,
62  * they should always add up to 0xFF = B11111111 = 255
63  *
64  * Control bytes:
65  * [01] - Timer (1-24 hours, Off)
66  * Time is hardcoded to OFF
67  *
68  * [03] - LAMP ON/OFF, TURBO ON/OFF, HOLD ON/OFF
69  * Lamp and Hold are hardcoded to OFF
70  * Turbo is used for the BOOST preset
71  *
72  * [05] - Indicates which button the user _pressed_ on the remote control
73  * Hardcoded to POWER-button
74  *
75  * [07] - POWER ON/OFF, FAN AUTO/3/2/1, SLEEP ON/OFF, AIRFLOW ON/OFF,
76  * VERTICAL SWING/WIND/FIXED
77  * SLEEP is used for preset SLEEP
78  * Vertical Swing supports Fixed, Swing and "Wind". The Wind option
79  * is ignored in this implementation
80  *
81  * [09] - MODE AUTO/COOL/VENT/DRY/HEAT, TEMPERATURE (16 - 32°C)
82  *
83  ***********************************************************************************/
84 
85 namespace esphome {
86 namespace zhlt01 {
87 
88 /********************************************************************************
89  * TIMINGS
90  * Space: Not used
91  * Header Mark: 6100 us
92  * Header Space: 7400 us
93  * Bit Mark: 500 us
94  * Zero Space: 600 us
95  * One Space: 1800 us
96  *
97  * Note : These timings are slightly different than those of ZHLT01HeatpumpIR
98  * The values below were measured by taking the average of 2 different
99  * remote controls each sending 10 commands
100  *******************************************************************************/
101 static const uint32_t AC1_HDR_MARK = 6100;
102 static const uint32_t AC1_HDR_SPACE = 7400;
103 static const uint32_t AC1_BIT_MARK = 500;
104 static const uint32_t AC1_ZERO_SPACE = 600;
105 static const uint32_t AC1_ONE_SPACE = 1800;
106 
107 /********************************************************************************
108  *
109  * ZHLT01 codes
110  *
111  *******************************************************************************/
112 
113 // Power
114 static const uint8_t AC1_POWER_OFF = 0x00;
115 static const uint8_t AC1_POWER_ON = 0x02;
116 
117 // Operating Modes
118 static const uint8_t AC1_MODE_AUTO = 0x00;
119 static const uint8_t AC1_MODE_COOL = 0x20;
120 static const uint8_t AC1_MODE_DRY = 0x40;
121 static const uint8_t AC1_MODE_FAN = 0x60;
122 static const uint8_t AC1_MODE_HEAT = 0x80;
123 
124 // Fan control
125 static const uint8_t AC1_FAN_AUTO = 0x00;
126 static const uint8_t AC1_FAN_SILENT = 0x01;
127 static const uint8_t AC1_FAN1 = 0x60;
128 static const uint8_t AC1_FAN2 = 0x40;
129 static const uint8_t AC1_FAN3 = 0x20;
130 static const uint8_t AC1_FAN_TURBO = 0x08;
131 
132 // Vertical Swing
133 static const uint8_t AC1_VDIR_WIND = 0x00; // "Natural Wind", ignore
134 static const uint8_t AC1_VDIR_SWING = 0x04; // Swing
135 static const uint8_t AC1_VDIR_FIXED = 0x08; // Fixed
136 
137 // Horizontal Swing
138 static const uint8_t AC1_HDIR_SWING = 0x00; // Swing
139 static const uint8_t AC1_HDIR_FIXED = 0x10; // Fixed
140 
141 // Temperature range
142 static const float AC1_TEMP_MIN = 16.0f;
143 static const float AC1_TEMP_MAX = 32.0f;
144 static const float AC1_TEMP_INC = 1.0f;
145 
147  public:
149  : climate_ir::ClimateIR(
150  AC1_TEMP_MIN, AC1_TEMP_MAX, AC1_TEMP_INC, true, true,
156 
157  void setup() override { climate_ir::ClimateIR::setup(); }
158 
159  protected:
161  void transmit_state() override;
163  bool on_receive(remote_base::RemoteReceiveData data) override;
164 };
165 
166 } // namespace zhlt01
167 } // namespace esphome
The fan mode is set to Low.
Definition: climate_mode.h:54
The fan mode is set to Both.
Definition: climate_mode.h:74
void setup() override
Definition: zhlt01.h:157
Device is prepared for sleep.
Definition: climate_mode.h:96
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
Definition: zhlt01.cpp:136
The fan mode is set to Horizontal.
Definition: climate_mode.h:78
The fan mode is set to Auto.
Definition: climate_mode.h:52
ClimateIR(float minimum_temperature, float maximum_temperature, float temperature_step=1.0f, bool supports_dry=false, bool supports_fan_only=false, std::set< climate::ClimateFanMode > fan_modes={}, std::set< climate::ClimateSwingMode > swing_modes={}, std::set< climate::ClimatePreset > presets={})
Definition: climate_ir.h:26
The fan mode is set to Vertical.
Definition: climate_mode.h:76
The fan mode is set to High.
Definition: climate_mode.h:58
The swing mode is set to Off.
Definition: climate_mode.h:72
Device is in boost preset.
Definition: climate_mode.h:90
void transmit_state() override
Transmit via IR the state of this climate controller.
Definition: zhlt01.cpp:9
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
The fan mode is set to Medium.
Definition: climate_mode.h:56