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 memset(remote_state, 0,
sizeof(remote_state));
58 remote_state[0] = 0x83;
59 remote_state[1] = 0x06;
60 remote_state[6] = 0x80;
61 remote_state[18] = 0x08;
77 remote_state[15] = 0x17;
106 remote_state[3] |= HISENSE_ARG_FIXED_TEMP_STEP << 4;
108 remote_state[3] |= temp_step << 4;
127 ESP_LOGV(TAG,
"send swing %s", this->
send_swing_cmd_ ? LOG_STR_LITERAL(
"true") : LOG_STR_LITERAL(
"false"));
143 remote_state[13] =
xor_bytes(&remote_state[2], 11, remote_state[13]);
144 remote_state[20] =
xor_bytes(&remote_state[14], 6, remote_state[20]);
150 auto *data = transmit.get_data();
152 data->set_carrier_frequency(38000);
159 if (i == WHIRLPOOL_FIRST_DIVIDER || i == WHIRLPOOL_SECOND_DIVIDER) {
164 data->item_bytes<WHIRLPOOL_BIT_TIMINGS>(remote_state + i, 1);
177#ifdef USE_WHIRLPOOL_HISENSE_ARG
178 remote_state[11] = HISENSE_ARG_DISPLAY_ON;
179 remote_state[12] = HISENSE_ARG_AMBIENT_TEMP;
180 remote_state[15] = power_toggle ? HISENSE_ARG_POWER_TOGGLE : HISENSE_ARG_SETTINGS_ONLY;
182 switch (this->
mode) {
189 remote_state[2] &= ~WHIRLPOOL_FAN_MASK;
200 remote_state[2] |= 0x30;
201 }
else if (temp_step == 6) {
202 remote_state[2] |= 0x50;
203 }
else if (temp_step == 8) {
204 remote_state[2] |= 0x40;
206 remote_state[2] |= 0x20;
218 ESP_LOGV(TAG,
"Blocked receive because of current trasmittion");
224 ESP_LOGV(TAG,
"Header fail");
229 memset(remote_state, 0,
sizeof(remote_state));
230 bool skip_footer =
false;
233 if (i == WHIRLPOOL_FIRST_DIVIDER || i == WHIRLPOOL_SECOND_DIVIDER) {
237 if (i == WHIRLPOOL_SECOND_DIVIDER && !data.is_valid()) {
239 ESP_LOGV(TAG,
"Remote control only sent %d bytes", i);
243 if (!data.expect_bytes<WHIRLPOOL_BIT_TIMINGS>(remote_state + i, 1))
248 ESP_LOGV(TAG,
"Footer fail");
253 uint8_t checksum13 =
xor_bytes(&remote_state[2], 11);
254 uint8_t checksum20 =
xor_bytes(&remote_state[14], 6);
256 if (checksum13 != remote_state[13] || (!skip_footer && checksum20 != remote_state[20])) {
257 ESP_LOGVV(TAG,
"Checksum fail");
264 if (remote_state[0] != 0x83 || remote_state[1] != 0x06)
283 auto mode = remote_state[3] & 0x7;
284 ESP_LOGV(TAG,
"Mode: %02X",
mode);
309 int temp = remote_state[3] & 0xF0;
310 ESP_LOGVV(TAG,
"Temperature Raw: %02X", temp);
311 temp = (uint8_t) temp >> 4;
313 ESP_LOGVV(TAG,
"Temperature Climate: %u", temp);
319 ESP_LOGVV(TAG,
"Fan: %02X", fan);
342 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...