7 static const char *
const TAG =
"zhlt01.climate";
10 uint8_t ir_message[12] = {0};
17 ir_message[3] = AC1_FAN_TURBO;
26 ir_message[7] = AC1_POWER_OFF;
28 ir_message[7] = AC1_POWER_ON;
34 ir_message[7] |= AC1_HDIR_FIXED | AC1_VDIR_FIXED;
37 ir_message[7] |= AC1_HDIR_SWING | AC1_VDIR_FIXED;
40 ir_message[7] |= AC1_HDIR_FIXED | AC1_VDIR_SWING;
43 ir_message[7] |= AC1_HDIR_SWING | AC1_VDIR_SWING;
52 ir_message[7] |= AC1_FAN3;
55 ir_message[7] |= AC1_FAN_SILENT;
60 ir_message[7] |= AC1_FAN1;
63 ir_message[7] |= AC1_FAN2;
66 ir_message[7] |= AC1_FAN3;
69 ir_message[7] |= AC1_FAN_AUTO;
81 ir_message[9] = AC1_MODE_AUTO;
84 ir_message[9] = AC1_MODE_COOL;
87 ir_message[9] = AC1_MODE_HEAT;
90 ir_message[9] = AC1_MODE_DRY;
93 ir_message[9] = AC1_MODE_FAN;
103 ir_message[11] = 0xD5;
106 for (
int i = 0; i < 12; i += 2) {
107 ir_message[i] = ~ir_message[i + 1];
117 data->mark(AC1_HDR_MARK);
118 data->space(AC1_HDR_SPACE);
121 for (uint8_t i : ir_message) {
122 for (uint8_t j = 0; j < 8; j++) {
123 data->mark(AC1_BIT_MARK);
124 bool bit = i & (1 << j);
125 data->space(bit ? AC1_ONE_SPACE : AC1_ZERO_SPACE);
130 data->mark(AC1_BIT_MARK);
138 if (!data.
expect_item(AC1_HDR_MARK, AC1_HDR_SPACE)) {
139 ESP_LOGV(TAG,
"Header fail");
144 uint8_t ir_message[12] = {0};
146 for (
int i = 0; i < 12; i++) {
148 for (
int j = 0; j < 8; j++) {
149 if (data.
expect_item(AC1_BIT_MARK, AC1_ONE_SPACE)) {
150 ir_message[i] |= 1 << j;
151 }
else if (!data.
expect_item(AC1_BIT_MARK, AC1_ZERO_SPACE)) {
152 ESP_LOGV(TAG,
"Byte %d bit %d fail", i, j);
156 ESP_LOGVV(TAG,
"Byte %d %02X", i, ir_message[i]);
161 ESP_LOGV(TAG,
"Footer fail");
166 for (
int i = 0; i < 12; i += 2) {
167 if (ir_message[i] != (uint8_t) (~ir_message[i + 1])) {
168 ESP_LOGV(TAG,
"Byte %d checksum incorrect (%02X != %02X)", i, ir_message[i], (uint8_t) (~ir_message[i + 1]));
174 if (ir_message[11] != 0xD5) {
175 ESP_LOGV(TAG,
"Invalid remote control ID");
181 if ((ir_message[7] & AC1_POWER_ON) == 0) {
185 if ((ir_message[7] & 0x0C) == AC1_VDIR_FIXED) {
186 if ((ir_message[7] & 0x10) == AC1_HDIR_FIXED) {
192 if ((ir_message[7] & 0x10) == AC1_HDIR_FIXED) {
200 if ((ir_message[3] & AC1_FAN_TURBO) == AC1_FAN_TURBO) {
203 }
else if ((ir_message[7] & 0xE1) == AC1_FAN_SILENT) {
206 }
else if ((ir_message[7] & 0xE1) == AC1_FAN_AUTO) {
208 }
else if ((ir_message[7] & 0xE1) == AC1_FAN1) {
210 }
else if ((ir_message[7] & 0xE1) == AC1_FAN2) {
212 }
else if ((ir_message[7] & 0xE1) == AC1_FAN3) {
217 if ((ir_message[9] & 0xE0) == AC1_MODE_COOL) {
219 }
else if ((ir_message[9] & 0xE0) == AC1_MODE_HEAT) {
221 }
else if ((ir_message[9] & 0xE0) == AC1_MODE_DRY) {
223 }
else if ((ir_message[9] & 0xE0) == AC1_MODE_FAN) {
The fan mode is set to Low.
value_type const & value() const
ClimateSwingMode swing_mode
The active swing mode of the climate device.
The fan mode is set to Both.
float target_temperature
The target temperature of the climate device.
void set_carrier_frequency(uint32_t carrier_frequency)
The climate device is set to heat to reach the target temperature.
ClimateMode mode
The active mode of the climate device.
The climate device is set to dry/humidity mode.
bool expect_mark(uint32_t length)
Device is prepared for sleep.
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
The fan mode is set to Horizontal.
The climate device is set to cool to reach the target temperature.
The fan mode is set to Auto.
optional< ClimatePreset > preset
The active preset of the climate device.
RemoteTransmitterBase * transmitter_
The climate device is adjusting the temperatre dynamically.
The climate device is set to heat/cool to reach the target temperature.
The fan mode is set to Vertical.
void publish_state()
Publish the state of the climate device, to be called from integrations.
The fan mode is set to High.
RemoteTransmitData * get_data()
The swing mode is set to Off.
The climate device is off.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
Device is in boost preset.
void transmit_state() override
Transmit via IR the state of this climate controller.
Implementation of SPI Controller mode.
The fan mode is set to Medium.
bool expect_item(uint32_t mark, uint32_t space)
The climate device only has the fan enabled, no heating or cooling is taking place.