19static constexpr uint8_t WHIRLPOOL_FIRST_DIVIDER = 6;
20static constexpr uint8_t WHIRLPOOL_SECOND_DIVIDER = 14;
41static constexpr uint8_t HISENSE_ARG_DISPLAY_ON = 0x80;
42static constexpr uint8_t HISENSE_ARG_AMBIENT_TEMP = 0x18;
43static constexpr uint8_t HISENSE_ARG_POWER_TOGGLE = 0x01;
44static constexpr uint8_t HISENSE_ARG_SETTINGS_ONLY = 0x02;
45static constexpr uint8_t HISENSE_ARG_FIXED_TEMP_STEP = 7;
48 : climate_ir::ClimateIR(
57 remote_state[0] = 0x83;
58 remote_state[1] = 0x06;
59 remote_state[6] = 0x80;
60 remote_state[18] = 0x08;
76 remote_state[15] = 0x17;
105 remote_state[3] |= HISENSE_ARG_FIXED_TEMP_STEP << 4;
107 remote_state[3] |= temp_step << 4;
126 ESP_LOGV(TAG,
"send swing %s", this->
send_swing_cmd_ ? LOG_STR_LITERAL(
"true") : LOG_STR_LITERAL(
"false"));
142 remote_state[13] =
xor_bytes(&remote_state[2], 11, remote_state[13]);
143 remote_state[20] =
xor_bytes(&remote_state[14], 6, remote_state[20]);
146 "Sending: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X "
148 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
149 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
150 remote_state[12], remote_state[13], remote_state[14], remote_state[15], remote_state[16], remote_state[17],
151 remote_state[18], remote_state[19], remote_state[20]);
155 auto *data = transmit.get_data();
157 data->set_carrier_frequency(38000);
164 if (i == WHIRLPOOL_FIRST_DIVIDER || i == WHIRLPOOL_SECOND_DIVIDER) {
169 data->item_bytes<WHIRLPOOL_BIT_TIMINGS>(remote_state + i, 1);
182#ifdef USE_WHIRLPOOL_HISENSE_ARG
183 remote_state[11] = HISENSE_ARG_DISPLAY_ON;
184 remote_state[12] = HISENSE_ARG_AMBIENT_TEMP;
185 remote_state[15] = power_toggle ? HISENSE_ARG_POWER_TOGGLE : HISENSE_ARG_SETTINGS_ONLY;
187 switch (this->
mode) {
194 remote_state[2] &= ~WHIRLPOOL_FAN_MASK;
205 remote_state[2] |= 0x30;
206 }
else if (temp_step == 6) {
207 remote_state[2] |= 0x50;
208 }
else if (temp_step == 8) {
209 remote_state[2] |= 0x40;
211 remote_state[2] |= 0x20;
223 ESP_LOGV(TAG,
"Blocked receive because of current trasmittion");
229 ESP_LOGV(TAG,
"Header fail");
234 bool skip_footer =
false;
237 if (i == WHIRLPOOL_FIRST_DIVIDER || i == WHIRLPOOL_SECOND_DIVIDER) {
241 if (i == WHIRLPOOL_SECOND_DIVIDER && !data.is_valid()) {
243 ESP_LOGV(TAG,
"Remote control only sent %d bytes", i);
247 if (!data.expect_bytes<WHIRLPOOL_BIT_TIMINGS>(remote_state + i, 1))
252 ESP_LOGV(TAG,
"Footer fail");
257 uint8_t checksum13 =
xor_bytes(&remote_state[2], 11);
258 uint8_t checksum20 =
xor_bytes(&remote_state[14], 6);
260 if (checksum13 != remote_state[13] || (!skip_footer && checksum20 != remote_state[20])) {
261 ESP_LOGVV(TAG,
"Checksum fail");
267 "Received: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X "
269 remote_state[0], remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5],
270 remote_state[6], remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11],
271 remote_state[12], remote_state[13], remote_state[14], remote_state[15], remote_state[16], remote_state[17],
272 remote_state[18], remote_state[19], remote_state[20]);
275 if (remote_state[0] != 0x83 || remote_state[1] != 0x06)
294 auto mode = remote_state[3] & 0x7;
295 ESP_LOGV(TAG,
"Mode: %02X",
mode);
320 int temp = remote_state[3] & 0xF0;
321 ESP_LOGVV(TAG,
"Temperature Raw: %02X", temp);
322 temp = (uint8_t) temp >> 4;
324 ESP_LOGVV(TAG,
"Temperature Climate: %u", temp);
330 ESP_LOGVV(TAG,
"Fan: %02X", fan);
353 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.
RemoteTransmitterBase * transmitter_
bool is_hisense_arg_() const
False when the model is compiled out, so the compiler drops the Hisense ARG branches.
uint32_t last_transmit_time_
Set the time of the last transmission.
bool fixed_temp_mode_() const
Modes in which the Hisense ARG model sends a fixed temperature.
void transmit_state() override
Transmit via IR the state of this climate controller.
void encode_hisense_arg_(uint8_t *remote_state, bool power_toggle, uint8_t temp_step) const
Add the Hisense ARG bytes on top of the common whirlpool frame.
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
ESPHOME_LOG_TAG(TAG, "whirlpool.climate")
const uint16_t WHIRLPOOL_BIT_MARK
const uint8_t WHIRLPOOL_FAN_MASK
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 uint8_t WHIRLPOOL_SWING_BYTE8
const uint8_t WHIRLPOOL_DRY
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
constexpr uint8_t xor_bytes(const uint8_t *data, size_t len, uint8_t init=0)
XOR the bytes of data with size len, starting from init.
uint32_t IRAM_ATTR HOT millis()
A bit is a mark (one_mark or zero_mark, both bit_mark unless set) and a space (one_space or zero_spac...