7static 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;
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]);
108 for (uint8_t i : remote_state) {
109 for (uint8_t j = 0; j < 8; j++) {
111 bool bit = i & (1 << j);
124 ESP_LOGV(TAG,
"Header fail");
132 for (
int j = 0; j < 8; j++) {
134 remote_state[i] |= 1 << j;
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");
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));
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);
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.
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.
value_type const & value() const
bool expect_item(uint32_t mark, uint32_t space)
bool expect_mark(uint32_t length)
void set_carrier_frequency(uint32_t carrier_frequency)
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
const uint16_t BALLU_HEADER_SPACE
const uint16_t BALLU_BIT_MARK
const float YKR_K_002E_TEMP_MIN
const uint8_t BALLU_STATE_LENGTH
const uint32_t BALLU_CARRIER_FREQUENCY
const float YKR_K_002E_TEMP_MAX
const uint8_t BALLU_SWING_VER
const uint8_t BALLU_FAN_LOW
const uint8_t BALLU_FAN_AUTO
const uint16_t BALLU_HEADER_MARK
const uint8_t BALLU_FAN_HIGH
const uint16_t BALLU_ZERO_SPACE
const uint8_t BALLU_POWER
const uint16_t BALLU_ONE_SPACE
const uint8_t BALLU_SWING_HOR
const uint8_t BALLU_FAN_MED
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
@ 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_OFF
The climate device is off.
@ CLIMATE_MODE_AUTO
The climate device is adjusting the temperature dynamically.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ 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.
Providing packet encoding functions for exchanging data with a remote host.
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)