5 namespace climate_ir_lg {
7 static const char *
const TAG =
"climate.climate_ir_lg";
35 uint32_t remote_state = 0x8800000;
69 ESP_LOGD(TAG,
"climate_lg_ir mode code: 0x%02X", this->
mode);
98 remote_state |= ((temp - 15) << TEMP_SHIFT);
107 uint32_t remote_state = 0;
109 if (!data.
expect_item(this->header_high_, this->header_low_))
112 for (nbits = 0; nbits < 32; nbits++) {
113 if (data.
expect_item(this->bit_high_, this->bit_one_low_)) {
114 remote_state = (remote_state << 1) | 1;
115 }
else if (data.
expect_item(this->bit_high_, this->bit_zero_low_)) {
116 remote_state = (remote_state << 1) | 0;
117 }
else if (nbits == BITS) {
124 ESP_LOGD(TAG,
"Decoded 0x%02" PRIX32, remote_state);
125 if ((remote_state & 0xFF00000) != 0x8800000)
128 if ((remote_state & COMMAND_MASK) == COMMAND_ON) {
130 }
else if ((remote_state & COMMAND_MASK) == COMMAND_ON_AI) {
134 if ((remote_state & COMMAND_MASK) == COMMAND_OFF) {
136 }
else if ((remote_state & COMMAND_MASK) == COMMAND_SWING) {
140 if ((remote_state & COMMAND_MASK) == COMMAND_AUTO) {
142 }
else if ((remote_state & COMMAND_MASK) == COMMAND_DRY_FAN) {
144 }
else if ((remote_state & COMMAND_MASK) == COMMAND_HEAT) {
159 if ((remote_state & FAN_MASK) ==
FAN_AUTO) {
161 }
else if ((remote_state & FAN_MASK) ==
FAN_MIN) {
163 }
else if ((remote_state & FAN_MASK) ==
FAN_MED) {
165 }
else if ((remote_state & FAN_MASK) ==
FAN_MAX) {
176 ESP_LOGD(TAG,
"Sending climate_lg_ir code: 0x%02" PRIX32, value);
182 data->reserve(2 + BITS * 2u);
186 for (uint32_t mask = 1UL << (BITS - 1); mask != 0; mask >>= 1) {
199 for (uint8_t i = 1; i < 8; i++) {
200 sum += (value & (mask << (i * 4))) >> (i * 4);
203 value |= (sum & mask);
The fan mode is set to Low.
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.
float target_temperature
The target temperature of the climate device.
void set_carrier_frequency(uint32_t carrier_frequency)
The climate device is set to heat to reach the target temperature.
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_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
const uint32_t COMMAND_ON
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 COMMAND_DRY_FAN
const uint32_t TEMP_SHIFT
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
const uint32_t COMMAND_HEAT
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
The fan mode is set to Medium.
bool expect_item(uint32_t mark, uint32_t space)