7 static const char *
const TAG =
"whirlpool.climate";
38 remote_state[0] = 0x83;
39 remote_state[1] = 0x06;
40 remote_state[6] = 0x80;
42 remote_state[18] = 0x08;
57 remote_state[15] = 0x17;
100 ESP_LOGV(TAG,
"send swing %s", this->
send_swing_cmd_ ?
"true" :
"false");
103 remote_state[2] |= 128;
104 remote_state[8] |= 64;
109 for (uint8_t i = 2; i < 13; i++)
110 remote_state[13] ^= remote_state[i];
111 for (uint8_t i = 14; i < 20; i++)
112 remote_state[20] ^= remote_state[i];
115 "Sending: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X " 117 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
118 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
119 remote_state[12], remote_state[13], remote_state[14], remote_state[15], remote_state[16], remote_state[17],
120 remote_state[18], remote_state[19], remote_state[20]);
129 data->mark(WHIRLPOOL_HEADER_MARK);
130 data->space(WHIRLPOOL_HEADER_SPACE);
133 for (uint8_t i : remote_state) {
134 for (uint8_t j = 0; j < 8; j++) {
135 data->mark(WHIRLPOOL_BIT_MARK);
136 bool bit = i & (1 << j);
137 data->space(bit ? WHIRLPOOL_ONE_SPACE : WHIRLPOOL_ZERO_SPACE);
140 if (bytes_sent == 6 || bytes_sent == 14) {
142 data->mark(WHIRLPOOL_BIT_MARK);
143 data->space(WHIRLPOOL_GAP);
147 data->mark(WHIRLPOOL_BIT_MARK);
155 ESP_LOGV(TAG,
"Blocked receive because of current trasmittion");
160 if (!data.
expect_item(WHIRLPOOL_HEADER_MARK, WHIRLPOOL_HEADER_SPACE)) {
161 ESP_LOGV(TAG,
"Header fail");
169 if (i == 6 || i == 14) {
170 if (!data.
expect_item(WHIRLPOOL_BIT_MARK, WHIRLPOOL_GAP))
173 for (
int j = 0; j < 8; j++) {
174 if (data.
expect_item(WHIRLPOOL_BIT_MARK, WHIRLPOOL_ONE_SPACE)) {
175 remote_state[i] |= 1 << j;
177 }
else if (!data.
expect_item(WHIRLPOOL_BIT_MARK, WHIRLPOOL_ZERO_SPACE)) {
178 ESP_LOGV(TAG,
"Byte %d bit %d fail", i, j);
183 ESP_LOGVV(TAG,
"Byte %d %02X", i, remote_state[i]);
187 ESP_LOGV(TAG,
"Footer fail");
191 uint8_t checksum13 = 0;
192 uint8_t checksum20 = 0;
194 for (uint8_t i = 2; i < 13; i++)
195 checksum13 ^= remote_state[i];
196 for (uint8_t i = 14; i < 20; i++)
197 checksum20 ^= remote_state[i];
199 if (checksum13 != remote_state[13] || checksum20 != remote_state[20]) {
200 ESP_LOGVV(TAG,
"Checksum fail");
206 "Received: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X " 208 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
209 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
210 remote_state[12], remote_state[13], remote_state[14], remote_state[15], remote_state[16], remote_state[17],
211 remote_state[18], remote_state[19], remote_state[20]);
214 if (remote_state[0] != 0x83 || remote_state[1] != 0x06)
218 ESP_LOGV(TAG,
"Power: %02X", (remote_state[2] & WHIRLPOOL_POWER));
220 if ((remote_state[2] & WHIRLPOOL_POWER) == WHIRLPOOL_POWER) {
233 auto mode = remote_state[3] & 0x7;
234 ESP_LOGV(TAG,
"Mode: %02X",
mode);
255 int temp = remote_state[3] & 0xF0;
256 ESP_LOGVV(TAG,
"Temperature Raw: %02X", temp);
257 temp = (uint8_t) temp >> 4;
259 ESP_LOGVV(TAG,
"Temperature Climate: %u", temp);
263 auto fan = remote_state[2] & 0x03;
264 ESP_LOGVV(TAG,
"Fan: %02X", fan);
282 if ((remote_state[2] & WHIRLPOOL_SWING_MASK) == WHIRLPOOL_SWING_MASK && remote_state[8] == 0x40) {
283 ESP_LOGVV(TAG,
"Swing toggle pressed ");
The fan mode is set to Low.
value_type const & value() const
ClimateSwingMode swing_mode
The active swing mode of the climate device.
const uint16_t WHIRLPOOL_BIT_MARK
const uint32_t WHIRLPOOL_GAP
const uint8_t WHIRLPOOL_AUTO
const uint16_t WHIRLPOOL_HEADER_MARK
const uint8_t WHIRLPOOL_FAN
float target_temperature
The target temperature of the climate device.
void set_carrier_frequency(uint32_t carrier_frequency)
const uint16_t WHIRLPOOL_HEADER_SPACE
const uint16_t WHIRLPOOL_ZERO_SPACE
The climate device is set to heat to reach the target temperature.
const uint8_t WHIRLPOOL_DRY
ClimateMode mode
The active mode of the climate device.
void transmit_state() override
Transmit via IR the state of this climate controller.
The climate device is set to dry/humidity mode.
const uint16_t WHIRLPOOL_ONE_SPACE
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)
bool expect_mark(uint32_t length)
uint32_t IRAM_ATTR HOT millis()
const uint8_t WHIRLPOOL_FAN_LOW
const uint8_t WHIRLPOOL_FAN_AUTO
const uint8_t WHIRLPOOL_SWING_MASK
int32_t last_transmit_time_
Set the time of the last transmission.
The climate device is set to cool to reach the target temperature.
The fan mode is set to Auto.
RemoteTransmitterBase * transmitter_
const uint8_t WHIRLPOOL_POWER
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.
const uint32_t WHIRLPOOL_CARRIER_FREQUENCY
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
Implementation of SPI Controller mode.
const uint8_t WHIRLPOOL_STATE_LENGTH
const uint8_t WHIRLPOOL_COOL
The fan mode is set to Medium.
const uint8_t WHIRLPOOL_FAN_HIGH
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
bool expect_item(uint32_t mark, uint32_t space)
The climate device only has the fan enabled, no heating or cooling is taking place.
const uint8_t WHIRLPOOL_FAN_MED
const uint8_t WHIRLPOOL_HEAT