5 namespace climate_ir_lg {
7 static 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);
102 remote_state |= ((temp - 15) << TEMP_SHIFT);
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)
133 if ((remote_state & COMMAND_MASK) == COMMAND_OFF) {
135 }
else if ((remote_state & COMMAND_MASK) == COMMAND_SWING) {
139 switch (remote_state & COMMAND_MASK) {
168 if ((remote_state & FAN_MASK) == FAN_AUTO) {
170 }
else if ((remote_state & FAN_MASK) == FAN_MIN) {
172 }
else if ((remote_state & FAN_MASK) == FAN_MED) {
174 }
else if ((remote_state & FAN_MASK) == FAN_MAX) {
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);
const uint32_t COMMAND_ON_HEAT
The fan mode is set to Low.
const uint32_t COMMAND_DRY
value_type const & value() const
const uint32_t COMMAND_MASK
climate::ClimateMode mode_before_
ClimateSwingMode swing_mode
The active swing mode of the climate device.
const uint32_t COMMAND_FAN_ONLY
float target_temperature
The target temperature of the climate device.
void set_carrier_frequency(uint32_t carrier_frequency)
const uint32_t COMMAND_ON_FAN_ONLY
The climate device is set to heat to reach the target temperature.
const uint32_t COMMAND_AI
ClimateMode mode
The active mode of the climate device.
void transmit_(uint32_t value)
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
The climate device is set to dry/humidity mode.
const uint32_t COMMAND_OFF
The climate device is set to cool to reach the target temperature.
The fan mode is set to Auto.
const uint32_t COMMAND_COOL
const uint32_t COMMAND_ON_AI
void calc_checksum_(uint32_t &value)
RemoteTransmitterBase * transmitter_
The climate device is set to heat/cool to reach the target temperature.
The fan mode is set to Vertical.
const uint32_t COMMAND_SWING
void transmit_state() override
Transmit via IR the state of this climate controller.
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.
const uint32_t TEMP_SHIFT
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
const uint32_t COMMAND_HEAT
const uint32_t COMMAND_ON_DRY
Implementation of SPI Controller mode.
The fan mode is set to Medium.
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 uint32_t COMMAND_ON_COOL