25static constexpr uint8_t STATE_LENGTH = 14;
26static constexpr uint8_t PREAMBLE_LENGTH = 5;
27static constexpr uint8_t PREAMBLE = 0x22;
29static constexpr uint8_t POWER_OFF = 0x20;
30static constexpr uint8_t POWER_MASK = 0x04;
31static constexpr uint8_t POWER_ON = POWER_OFF | POWER_MASK;
33static constexpr uint8_t MODE_HEAT = 0x01;
34static constexpr uint8_t MODE_COOL = 0x03;
35static constexpr uint8_t MODE_FAN = 0x04;
37static constexpr uint8_t FAN_AUTO = 0x00;
38static constexpr uint8_t FAN_LOW_ALT = 0x01;
39static constexpr uint8_t FAN_LOW = 0x02;
40static constexpr uint8_t FAN_HIGH = 0x04;
41static constexpr uint8_t FAN_TIMER_FLAG = 0x40;
43static constexpr uint8_t TEMP_DEFAULT = 72;
45static constexpr uint16_t HEADER_MARK = 3608;
46static constexpr uint16_t HEADER_SPACE = 1520;
47static constexpr uint16_t BIT_MARK = 560;
48static constexpr uint16_t ONE_SPACE = 1208;
49static constexpr uint16_t ZERO_SPACE = 408;
50static constexpr uint32_t CARRIER_FREQUENCY = 38000;
52 .bit_mark = BIT_MARK, .one_space = ONE_SPACE, .zero_space = ZERO_SPACE};
64 LOG_CLIMATE(
"",
"Islandaire Climate",
this);
69 auto traits = ClimateIR::traits();
75 uint8_t remote_state[STATE_LENGTH] = {0};
77 std::fill_n(remote_state, PREAMBLE_LENGTH, PREAMBLE);
83 remote_state[6] = MODE_HEAT;
86 remote_state[6] = MODE_FAN;
90 remote_state[6] = MODE_COOL;
102 remote_state[8] = FAN_LOW;
105 remote_state[8] = FAN_HIGH;
109 remote_state[8] = FAN_AUTO;
113 remote_state[STATE_LENGTH - 1] =
sum_bytes(remote_state, STATE_LENGTH - 1);
115 ESP_LOGV_HEX(TAG, remote_state, STATE_LENGTH, STATE_LENGTH,
"Sending: %s");
118 auto *data = transmit.get_data();
120 data->set_carrier_frequency(CARRIER_FREQUENCY);
122 data->reserve(2 + STATE_LENGTH * 16 + 1);
123 data->item(HEADER_MARK, HEADER_SPACE);
124 data->item_bytes<BIT_TIMINGS>(remote_state, STATE_LENGTH);
125 data->mark(BIT_MARK);
131 if (!data.expect_item(HEADER_MARK, HEADER_SPACE)) {
132 ESP_LOGVV(TAG,
"Header fail");
136 uint8_t remote_state[STATE_LENGTH];
137 if (!data.expect_bytes<BIT_TIMINGS>(remote_state, STATE_LENGTH)) {
138 ESP_LOGVV(TAG,
"Data fail");
141 if (!data.expect_mark(BIT_MARK)) {
142 ESP_LOGVV(TAG,
"Footer fail");
146 if (
sum_bytes(remote_state, STATE_LENGTH - 1) != remote_state[STATE_LENGTH - 1]) {
147 ESP_LOGVV(TAG,
"Checksum fail");
151 for (uint8_t i = 0; i < PREAMBLE_LENGTH; i++) {
152 if (remote_state[i] != PREAMBLE)
156 ESP_LOGV_HEX(TAG, remote_state, STATE_LENGTH, STATE_LENGTH,
"Received: %s");
158 if ((remote_state[5] & POWER_MASK) == 0) {
161 switch (remote_state[6]) {
172 ESP_LOGV(TAG,
"Unknown mode 0x%02X", remote_state[6]);
177 const uint8_t temp_f = remote_state[7];
181 switch (remote_state[8] & ~FAN_TIMER_FLAG) {
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.
void publish_state()
Publish the state of the climate device, to be called from integrations.
void set_temperature_unit(TemperatureUnit unit)
void transmit_state() override
bool on_receive(remote_base::RemoteReceiveData data) override
static constexpr uint8_t TEMP_MIN
void dump_config() override
climate::ClimateTraits traits() override
static constexpr uint8_t TEMP_MAX
RemoteTransmitterBase * transmitter_
@ 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_OFF
The climate device is off.
@ 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.
ESPHOME_LOG_TAG(TAG, "islandaire.climate")
constexpr uint8_t sum_bytes(const uint8_t *data, size_t len, uint8_t sum=0)
Add up the bytes of data with size len, truncated to 8 bits: the checksum many serial and IR protocol...
A bit is a mark (one_mark or zero_mark, both bit_mark unless set) and a space (one_space or zero_spac...