7static const char *
const TAG =
"tcl112.climate";
39 remote_state[0] = 0x23;
40 remote_state[1] = 0xCB;
41 remote_state[2] = 0x26;
42 remote_state[3] = 0x01;
43 remote_state[5] = 0x24;
44 remote_state[6] = 0x03;
45 remote_state[7] = 0x07;
46 remote_state[8] = 0x40;
51 remote_state[6] &= 0xF0;
55 remote_state[6] &= 0xF0;
59 remote_state[6] &= 0xF0;
63 remote_state[6] &= 0xF0;
67 remote_state[6] &= 0xF0;
72 remote_state[5] &= ~TCL112_POWER_MASK;
81 auto half_degrees =
static_cast<uint8_t
>(safecelsius * 2);
82 if (half_degrees & 1) {
85 remote_state[12] &= ~TCL112_HALF_DEGREE;
87 remote_state[7] &= 0xF0;
106 remote_state[8] |= selected_fan;
118 ESP_LOGV(TAG,
"Sending: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", remote_state[0],
119 remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5], remote_state[6],
120 remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11], remote_state[12],
132 for (uint8_t i : remote_state) {
133 for (uint8_t j = 0; j < 8; j++) {
135 bool bit = i & (1 << j);
149 ESP_LOGVV(TAG,
"Header fail");
157 for (
int j = 0; j < 8; j++) {
159 remote_state[i] |= 1 << j;
161 ESP_LOGVV(TAG,
"Byte %d bit %d fail", i, j);
168 ESP_LOGVV(TAG,
"Footer fail");
176 checksum += remote_state[checksum_byte];
178 ESP_LOGVV(TAG,
"Checksum fail");
182 ESP_LOGV(TAG,
"Received: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X",
183 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
184 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
185 remote_state[12], remote_state[13]);
188 if (remote_state[0] != 0x23 || remote_state[1] != 0xCB)
194 auto mode = remote_state[6] & 0x0F;
217 auto fan = remote_state[8] & 0x7;
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.
value_type const & value() const
bool expect_item(uint32_t mark, uint32_t space)
bool expect_mark(uint32_t length)
void set_carrier_frequency(uint32_t carrier_frequency)
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
void transmit_state() override
Transmit via IR the state of this climate controller.
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ 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.
const uint8_t TCL112_AUTO
const float TCL112_TEMP_MAX
const uint16_t TCL112_BIT_MARK
const uint8_t TCL112_HALF_DEGREE
const uint8_t TCL112_VSWING_MASK
const uint16_t TCL112_HEADER_MARK
const uint16_t TCL112_ONE_SPACE
const uint16_t TCL112_HEADER_SPACE
const uint32_t TCL112_GAP
const uint8_t TCL112_FAN_MED
const uint8_t TCL112_FAN_HIGH
const uint16_t TCL112_ZERO_SPACE
const float TCL112_TEMP_MIN
const uint8_t TCL112_FAN_LOW
const uint8_t TCL112_FAN_AUTO
const uint8_t TCL112_COOL
const uint16_t TCL112_BITS
const uint8_t TCL112_POWER_MASK
const uint16_t TCL112_STATE_LENGTH
const uint8_t TCL112_HEAT
Providing packet encoding functions for exchanging data with a remote host.