ESPHome  2024.10.2
climate_ir_lg.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <cinttypes>
6 
7 namespace esphome {
8 namespace climate_ir_lg {
9 
10 // Temperature
11 const uint8_t TEMP_MIN = 18; // Celsius
12 const uint8_t TEMP_MAX = 30; // Celsius
13 
15  public:
17  : climate_ir::ClimateIR(TEMP_MIN, TEMP_MAX, 1.0f, true, true,
21 
23  void control(const climate::ClimateCall &call) override {
25  // swing resets after unit powered off
26  if (call.get_mode().has_value() && *call.get_mode() == climate::CLIMATE_MODE_OFF)
29  }
30  void set_header_high(uint32_t header_high) { this->header_high_ = header_high; }
31  void set_header_low(uint32_t header_low) { this->header_low_ = header_low; }
32  void set_bit_high(uint32_t bit_high) { this->bit_high_ = bit_high; }
33  void set_bit_one_low(uint32_t bit_one_low) { this->bit_one_low_ = bit_one_low; }
34  void set_bit_zero_low(uint32_t bit_zero_low) { this->bit_zero_low_ = bit_zero_low; }
35 
36  protected:
38  void transmit_state() override;
40  bool on_receive(remote_base::RemoteReceiveData data) override;
41 
42  bool send_swing_cmd_{false};
43 
44  void calc_checksum_(uint32_t &value);
45  void transmit_(uint32_t value);
46 
47  uint32_t header_high_;
48  uint32_t header_low_;
49  uint32_t bit_high_;
50  uint32_t bit_one_low_;
51  uint32_t bit_zero_low_;
52 
54 };
55 
56 } // namespace climate_ir_lg
57 } // namespace esphome
This class is used to encode all control actions on a climate device.
Definition: climate.h:33
The fan mode is set to Low.
Definition: climate_mode.h:54
climate::ClimateMode mode_before_
Definition: climate_ir_lg.h:53
ClimateSwingMode swing_mode
The active swing mode of the climate device.
Definition: climate.h:202
const uint8_t TEMP_MIN
Definition: climate_ir_lg.h:11
void set_header_low(uint32_t header_low)
Definition: climate_ir_lg.h:31
const optional< ClimateMode > & get_mode() const
Definition: climate.cpp:273
void set_bit_one_low(uint32_t bit_one_low)
Definition: climate_ir_lg.h:33
void set_header_high(uint32_t header_high)
Definition: climate_ir_lg.h:30
void set_bit_zero_low(uint32_t bit_zero_low)
Definition: climate_ir_lg.h:34
bool has_value() const
Definition: optional.h:87
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
Definition: climate_ir.cpp:61
void set_bit_high(uint32_t bit_high)
Definition: climate_ir_lg.h:32
The fan mode is set to Auto.
Definition: climate_mode.h:52
void calc_checksum_(uint32_t &value)
ClimateIR(float minimum_temperature, float maximum_temperature, float temperature_step=1.0f, bool supports_dry=false, bool supports_fan_only=false, std::set< climate::ClimateFanMode > fan_modes={}, std::set< climate::ClimateSwingMode > swing_modes={}, std::set< climate::ClimatePreset > presets={})
Definition: climate_ir.h:26
The fan mode is set to Vertical.
Definition: climate_mode.h:76
void transmit_state() override
Transmit via IR the state of this climate controller.
The fan mode is set to High.
Definition: climate_mode.h:58
ClimateMode
Enum for all modes a climate device can be in.
Definition: climate_mode.h:10
The swing mode is set to Off.
Definition: climate_mode.h:72
The climate device is off.
Definition: climate_mode.h:12
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
Definition: climate_ir_lg.h:23
const optional< ClimateSwingMode > & get_swing_mode() const
Definition: climate.cpp:282
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
const uint8_t TEMP_MAX
Definition: climate_ir_lg.h:12
The fan mode is set to Medium.
Definition: climate_mode.h:56