6static const char *
const TAG =
"climate.climate_ir_lg";
126 ESP_LOGD(TAG,
"setting swing vertical");
131 ESP_LOGD(TAG,
"setting swing off");
147 switch (this->
mode) {
172 ESP_LOGD(TAG,
"climate_lg_ir mode code: 0x%02X", this->
mode);
195 switch (this->
mode) {
218 if (!data.expect_item(this->header_high_, this->header_low_))
221 for (nbits = 0; nbits < 32; nbits++) {
222 if (data.expect_item(this->bit_high_, this->bit_one_low_)) {
223 remote_state = (remote_state << 1) | 1;
224 }
else if (data.expect_item(this->bit_high_, this->bit_zero_low_)) {
225 remote_state = (remote_state << 1) | 0;
226 }
else if (nbits ==
BITS) {
233 ESP_LOGD(TAG,
"Received 0x%02" PRIX32, remote_state);
234 if ((remote_state & 0xFF00000) !=
LG_HEADER)
240 ESP_LOGD(TAG,
"Got system command! With data: 0x%02" PRIX32, remote_state &
COMMAND_DATA_MASK);
248 ESP_LOGD(TAG,
"Got advanced swing command! With data: 0x%02" PRIX32,
272 switch (this->
mode) {
284 ESP_LOGD(TAG,
"Got jet command, but current mode does not support it! Ignoring.");
319 ESP_LOGD(TAG,
"Got unknown command! Ignoring!");
340 ESP_LOGD(TAG,
"Got unknown fan speed! Ignoring!");
350 switch (this->
mode) {
368 ESP_LOGD(TAG,
"Sending climate_lg_ir code: 0x%02" PRIX32, value);
371 auto *data = transmit.get_data();
373 data->set_carrier_frequency(38000);
374 data->reserve(2 +
BITS * 2u);
378 for (
uint32_t mask = 1UL << (
BITS - 1); mask != 0; mask >>= 1) {
391 for (uint8_t i = 1; i < 8; i++) {
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.
float maximum_temperature_
float minimum_temperature_
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
climate::ClimateMode mode_before_
void transmit_state() override
Transmit via IR the state of this climate controller.
void transmit_(uint32_t value)
void calc_checksum_(uint32_t &value)
bool advanced_commands_support_
RemoteTransmitterBase * transmitter_
const uint32_t COMMAND_COOL
const uint32_t CHECKSUM_MASK
const uint32_t COMMAND_DATA_MASK
const uint32_t COMMAND_ON_FAN_ONLY
const uint32_t TEMP_SHIFT
const uint32_t COMMAND_HEADER_MASK
const uint32_t COMMAND_ON_DRY
const uint32_t FAN_SPEED_MASK
const uint32_t COMMAND_FAN_ONLY
const uint32_t COMMAND_ON_COOL
const uint32_t COMMAND_AI
const uint32_t COMMAND_DRY
const uint32_t COMMAND_HEAT
const uint32_t COMMAND_ON_AI
const uint32_t COMMAND_ON_HEAT
@ 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.