5namespace climate_ir_lg {
7static const char *
const TAG =
"climate.climate_ir_lg";
41 uint32_t remote_state = 0x8800000;
76 ESP_LOGD(TAG,
"climate_lg_ir mode code: 0x%02X", this->
mode);
111 uint32_t remote_state = 0;
113 if (!data.
expect_item(this->header_high_, this->header_low_))
116 for (nbits = 0; nbits < 32; nbits++) {
117 if (data.
expect_item(this->bit_high_, this->bit_one_low_)) {
118 remote_state = (remote_state << 1) | 1;
119 }
else if (data.
expect_item(this->bit_high_, this->bit_zero_low_)) {
120 remote_state = (remote_state << 1) | 0;
121 }
else if (nbits ==
BITS) {
128 ESP_LOGD(TAG,
"Decoded 0x%02" PRIX32, remote_state);
129 if ((remote_state & 0xFF00000) != 0x8800000)
191 ESP_LOGD(TAG,
"Sending climate_lg_ir code: 0x%02" PRIX32, value);
197 data->reserve(2 +
BITS * 2u);
201 for (uint32_t mask = 1UL << (
BITS - 1); mask != 0; mask >>= 1) {
214 for (uint8_t i = 1; i < 8; i++) {
215 sum += (value & (mask << (i * 4))) >> (i * 4);
218 value |= (sum & mask);
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.
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)
value_type const & value() const
bool expect_item(uint32_t mark, uint32_t space)
void set_carrier_frequency(uint32_t carrier_frequency)
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
const uint32_t COMMAND_OFF
const uint32_t COMMAND_COOL
const uint32_t COMMAND_ON_FAN_ONLY
const uint32_t TEMP_SHIFT
const uint32_t COMMAND_ON_DRY
const uint32_t COMMAND_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_SWING
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_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.