7static const char *
const TAG =
"whirlpool.climate";
36 : climate_ir::ClimateIR(
45 remote_state[0] = 0x83;
46 remote_state[1] = 0x06;
47 remote_state[6] = 0x80;
49 remote_state[18] = 0x08;
64 remote_state[15] = 0x17;
107 ESP_LOGV(TAG,
"send swing %s", this->
send_swing_cmd_ ?
"true" :
"false");
110 remote_state[2] |= 128;
111 remote_state[8] |= 64;
116 for (uint8_t i = 2; i < 13; i++)
117 remote_state[13] ^= remote_state[i];
118 for (uint8_t i = 14; i < 20; i++)
119 remote_state[20] ^= remote_state[i];
122 "Sending: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X "
124 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
125 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
126 remote_state[12], remote_state[13], remote_state[14], remote_state[15], remote_state[16], remote_state[17],
127 remote_state[18], remote_state[19], remote_state[20]);
140 for (uint8_t i : remote_state) {
141 for (uint8_t j = 0; j < 8; j++) {
143 bool bit = i & (1 << j);
147 if (bytes_sent == 6 || bytes_sent == 14) {
162 ESP_LOGV(TAG,
"Blocked receive because of current trasmittion");
168 ESP_LOGV(TAG,
"Header fail");
173 bool skip_footer =
false;
177 if (i == 6 || i == 14) {
183 ESP_LOGV(TAG,
"Remote control only sent %d bytes", i);
188 for (
int j = 0; j < 8; j++) {
190 remote_state[i] |= 1 << j;
193 ESP_LOGV(TAG,
"Byte %d bit %d fail", i, j);
198 ESP_LOGVV(TAG,
"Byte %d %02X", i, remote_state[i]);
202 ESP_LOGV(TAG,
"Footer fail");
206 uint8_t checksum13 = 0;
207 uint8_t checksum20 = 0;
209 for (uint8_t i = 2; i < 13; i++)
210 checksum13 ^= remote_state[i];
211 for (uint8_t i = 14; i < 20; i++)
212 checksum20 ^= remote_state[i];
214 if (checksum13 != remote_state[13] || (!skip_footer && checksum20 != remote_state[20])) {
215 ESP_LOGVV(TAG,
"Checksum fail");
221 "Received: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X "
223 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
224 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
225 remote_state[12], remote_state[13], remote_state[14], remote_state[15], remote_state[16], remote_state[17],
226 remote_state[18], remote_state[19], remote_state[20]);
229 if (remote_state[0] != 0x83 || remote_state[1] != 0x06)
248 auto mode = remote_state[3] & 0x7;
249 ESP_LOGV(TAG,
"Mode: %02X",
mode);
270 int temp = remote_state[3] & 0xF0;
271 ESP_LOGVV(TAG,
"Temperature Raw: %02X", temp);
272 temp = (uint8_t) temp >> 4;
274 ESP_LOGVV(TAG,
"Temperature Climate: %u", temp);
278 auto fan = remote_state[2] & 0x03;
279 ESP_LOGVV(TAG,
"Fan: %02X", fan);
298 ESP_LOGVV(TAG,
"Swing toggle pressed ");
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.
bool expect_item(uint32_t mark, uint32_t space)
bool expect_mark(uint32_t length)
bool is_valid(uint32_t offset=0) const
void set_carrier_frequency(uint32_t carrier_frequency)
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
uint32_t last_transmit_time_
Set the time of the last transmission.
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_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.
const uint8_t WHIRLPOOL_COOL
const uint16_t WHIRLPOOL_BIT_MARK
const float WHIRLPOOL_DG11J1_3A_TEMP_MAX
const uint16_t WHIRLPOOL_HEADER_SPACE
const uint8_t WHIRLPOOL_FAN_MED
const uint8_t WHIRLPOOL_FAN_AUTO
const uint8_t WHIRLPOOL_SWING_MASK
const uint8_t WHIRLPOOL_STATE_LENGTH
const uint32_t WHIRLPOOL_CARRIER_FREQUENCY
const uint8_t WHIRLPOOL_FAN_LOW
const uint16_t WHIRLPOOL_ZERO_SPACE
const uint8_t WHIRLPOOL_DRY
const uint16_t WHIRLPOOL_ONE_SPACE
const uint16_t WHIRLPOOL_HEADER_MARK
const float WHIRLPOOL_DG11J1_3A_TEMP_MIN
const uint8_t WHIRLPOOL_HEAT
const uint8_t WHIRLPOOL_AUTO
const uint8_t WHIRLPOOL_POWER
const uint8_t WHIRLPOOL_FAN
const uint8_t WHIRLPOOL_FAN_HIGH
const uint32_t WHIRLPOOL_GAP
Providing packet encoding functions for exchanging data with a remote host.
uint32_t IRAM_ATTR HOT millis()