8static constexpr uint8_t ZHLT01_MESSAGE_LENGTH = 12;
11 uint8_t ir_message[ZHLT01_MESSAGE_LENGTH] = {0};
18 ir_message[3] = AC1_FAN_TURBO;
27 ir_message[7] = AC1_POWER_OFF;
29 ir_message[7] = AC1_POWER_ON;
35 ir_message[7] |= AC1_HDIR_FIXED | AC1_VDIR_FIXED;
38 ir_message[7] |= AC1_HDIR_SWING | AC1_VDIR_FIXED;
41 ir_message[7] |= AC1_HDIR_FIXED | AC1_VDIR_SWING;
44 ir_message[7] |= AC1_HDIR_SWING | AC1_VDIR_SWING;
53 ir_message[7] |= AC1_FAN3;
56 ir_message[7] |= AC1_FAN_SILENT;
61 ir_message[7] |= AC1_FAN1;
64 ir_message[7] |= AC1_FAN2;
67 ir_message[7] |= AC1_FAN3;
70 ir_message[7] |= AC1_FAN_AUTO;
82 ir_message[9] = AC1_MODE_AUTO;
85 ir_message[9] = AC1_MODE_COOL;
88 ir_message[9] = AC1_MODE_HEAT;
91 ir_message[9] = AC1_MODE_DRY;
94 ir_message[9] = AC1_MODE_FAN;
104 ir_message[11] = 0xD5;
107 for (
int i = 0; i < ZHLT01_MESSAGE_LENGTH; i += 2) {
108 ir_message[i] = ~ir_message[i + 1];
113 auto *data = transmit.get_data();
115 data->set_carrier_frequency(38000);
118 data->mark(AC1_HDR_MARK);
119 data->space(AC1_HDR_SPACE);
122 data->item_bytes<AC1_BIT_TIMINGS>(ir_message,
sizeof(ir_message));
125 data->mark(AC1_BIT_MARK);
133 if (!data.expect_item(AC1_HDR_MARK, AC1_HDR_SPACE)) {
134 ESP_LOGV(TAG,
"Header fail");
139 uint8_t ir_message[ZHLT01_MESSAGE_LENGTH];
140 if (!data.expect_bytes<AC1_BIT_TIMINGS>(ir_message,
sizeof(ir_message))) {
141 ESP_LOGV(TAG,
"Data fail");
146 if (!data.expect_mark(AC1_BIT_MARK)) {
147 ESP_LOGV(TAG,
"Footer fail");
152 for (
int i = 0; i < ZHLT01_MESSAGE_LENGTH; i += 2) {
153 if (ir_message[i] != (uint8_t) (~ir_message[i + 1])) {
154 ESP_LOGV(TAG,
"Byte %d checksum incorrect (%02X != %02X)", i, ir_message[i], (uint8_t) (~ir_message[i + 1]));
160 if (ir_message[11] != 0xD5) {
161 ESP_LOGV(TAG,
"Invalid remote control ID");
167 if ((ir_message[7] & AC1_POWER_ON) == 0) {
171 if ((ir_message[7] & 0x0C) == AC1_VDIR_FIXED) {
172 if ((ir_message[7] & 0x10) == AC1_HDIR_FIXED) {
178 if ((ir_message[7] & 0x10) == AC1_HDIR_FIXED) {
186 if ((ir_message[3] & AC1_FAN_TURBO) == AC1_FAN_TURBO) {
189 }
else if ((ir_message[7] & 0xE1) == AC1_FAN_SILENT) {
192 }
else if ((ir_message[7] & 0xE1) == AC1_FAN_AUTO) {
194 }
else if ((ir_message[7] & 0xE1) == AC1_FAN1) {
196 }
else if ((ir_message[7] & 0xE1) == AC1_FAN2) {
198 }
else if ((ir_message[7] & 0xE1) == AC1_FAN3) {
203 if ((ir_message[9] & 0xE0) == AC1_MODE_COOL) {
205 }
else if ((ir_message[9] & 0xE0) == AC1_MODE_HEAT) {
207 }
else if ((ir_message[9] & 0xE0) == AC1_MODE_DRY) {
209 }
else if ((ir_message[9] & 0xE0) == AC1_MODE_FAN) {
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.
optional< ClimatePreset > preset
The active preset of the climate device.
RemoteTransmitterBase * transmitter_
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
void transmit_state() override
Transmit via IR the state of this climate controller.
@ CLIMATE_PRESET_NONE
No preset is active.
@ CLIMATE_PRESET_BOOST
Device is in boost preset.
@ CLIMATE_PRESET_SLEEP
Device is prepared for sleep.
@ 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_MODE_AUTO
The climate device is adjusting the temperature dynamically.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_ON
The fan mode is set to On.
@ 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.
ESPHOME_LOG_TAG(TAG, "zhlt01.climate")