7 static const char *
const TAG =
"ballu.climate";
43 remote_state[0] = 0xc3;
44 remote_state[1] = ((temp - 8) << 3) | (swing_ver ? 0 :
BALLU_SWING_VER);
47 remote_state[11] = 0x1e;
91 for (uint8_t i = 0; i < BALLU_STATE_LENGTH - 1; i++)
92 remote_state[12] += remote_state[i];
94 ESP_LOGV(TAG,
"Sending: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", remote_state[0],
95 remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5], remote_state[6],
96 remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11], remote_state[12]);
105 data->mark(BALLU_HEADER_MARK);
106 data->space(BALLU_HEADER_SPACE);
108 for (uint8_t i : remote_state) {
109 for (uint8_t j = 0; j < 8; j++) {
110 data->mark(BALLU_BIT_MARK);
111 bool bit = i & (1 << j);
112 data->space(bit ? BALLU_ONE_SPACE : BALLU_ZERO_SPACE);
116 data->mark(BALLU_BIT_MARK);
123 if (!data.
expect_item(BALLU_HEADER_MARK, BALLU_HEADER_SPACE)) {
124 ESP_LOGV(TAG,
"Header fail");
132 for (
int j = 0; j < 8; j++) {
133 if (data.
expect_item(BALLU_BIT_MARK, BALLU_ONE_SPACE)) {
134 remote_state[i] |= 1 << j;
136 }
else if (!data.
expect_item(BALLU_BIT_MARK, BALLU_ZERO_SPACE)) {
137 ESP_LOGV(TAG,
"Byte %d bit %d fail", i, j);
142 ESP_LOGVV(TAG,
"Byte %d %02X", i, remote_state[i]);
146 ESP_LOGV(TAG,
"Footer fail");
152 for (uint8_t i = 0; i < BALLU_STATE_LENGTH - 1; i++)
153 checksum += remote_state[i];
155 if (checksum != remote_state[BALLU_STATE_LENGTH - 1]) {
156 ESP_LOGVV(TAG,
"Checksum fail");
160 ESP_LOGV(TAG,
"Received: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", remote_state[0],
161 remote_state[1], remote_state[2], remote_state[3], remote_state[4], remote_state[5], remote_state[6],
162 remote_state[7], remote_state[8], remote_state[9], remote_state[10], remote_state[11], remote_state[12]);
165 if (remote_state[0] != 0xc3)
169 ESP_LOGV(TAG,
"Power: %02X", (remote_state[9] & BALLU_POWER));
171 if ((remote_state[9] & BALLU_POWER) != BALLU_POWER) {
174 auto mode = remote_state[6] & 0xe0;
175 ESP_LOGV(TAG,
"Mode: %02X",
mode);
196 int temp = remote_state[1] & 0xf8;
197 ESP_LOGVV(TAG,
"Temperature Raw: %02X", temp);
198 temp = ((uint8_t) temp >> 3) + 8;
199 ESP_LOGVV(TAG,
"Temperature Climate: %u", temp);
203 auto fan = remote_state[4] & 0xe0;
204 ESP_LOGVV(TAG,
"Fan: %02X", fan);
222 ESP_LOGVV(TAG,
"Swing status: %02X %02X", remote_state[1] & BALLU_SWING_VER, remote_state[2] & BALLU_SWING_HOR);
223 if (((remote_state[1] & BALLU_SWING_VER) != BALLU_SWING_VER) &&
224 ((remote_state[2] & BALLU_SWING_HOR) != BALLU_SWING_HOR)) {
226 }
else if ((remote_state[1] & BALLU_SWING_VER) != BALLU_SWING_VER) {
228 }
else if ((remote_state[2] & BALLU_SWING_HOR) != BALLU_SWING_HOR) {
The fan mode is set to Low.
value_type const & value() const
ClimateSwingMode swing_mode
The active swing mode of the climate device.
const uint8_t BALLU_FAN_HIGH
The fan mode is set to Both.
const uint8_t BALLU_STATE_LENGTH
float target_temperature
The target temperature of the climate device.
void set_carrier_frequency(uint32_t carrier_frequency)
const uint8_t BALLU_FAN_AUTO
const uint8_t BALLU_POWER
The climate device is set to heat to reach the target temperature.
ClimateMode mode
The active mode of the climate device.
const float YKR_K_002E_TEMP_MAX
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
void transmit_state() override
Transmit via IR the state of this climate controller.
const uint32_t BALLU_CARRIER_FREQUENCY
The climate device is set to dry/humidity mode.
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)
bool expect_mark(uint32_t length)
const uint16_t BALLU_HEADER_MARK
const uint16_t BALLU_ZERO_SPACE
const uint8_t BALLU_SWING_VER
const float YKR_K_002E_TEMP_MIN
The fan mode is set to Horizontal.
The climate device is set to cool to reach the target temperature.
The fan mode is set to Auto.
RemoteTransmitterBase * transmitter_
const uint8_t BALLU_FAN_LOW
const uint8_t BALLU_SWING_HOR
The climate device is adjusting the temperatre dynamically.
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.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
Implementation of SPI Controller mode.
const uint16_t BALLU_ONE_SPACE
The fan mode is set to Medium.
const uint16_t BALLU_HEADER_SPACE
const uint8_t BALLU_FAN_MED
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 uint16_t BALLU_BIT_MARK