ESPHome  2021.11.3
climate_ir_lg.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace esphome {
6 namespace climate_ir_lg {
7 
8 // Temperature
9 const uint8_t TEMP_MIN = 18; // Celsius
10 const uint8_t TEMP_MAX = 30; // Celsius
11 
13  public:
15  : climate_ir::ClimateIR(TEMP_MIN, TEMP_MAX, 1.0f, true, false,
19 
21  void control(const climate::ClimateCall &call) override {
23  // swing resets after unit powered off
24  if (call.get_mode().has_value() && *call.get_mode() == climate::CLIMATE_MODE_OFF)
27  }
28  void set_header_high(uint32_t header_high) { this->header_high_ = header_high; }
29  void set_header_low(uint32_t header_low) { this->header_low_ = header_low; }
30  void set_bit_high(uint32_t bit_high) { this->bit_high_ = bit_high; }
31  void set_bit_one_low(uint32_t bit_one_low) { this->bit_one_low_ = bit_one_low; }
32  void set_bit_zero_low(uint32_t bit_zero_low) { this->bit_zero_low_ = bit_zero_low; }
33 
34  protected:
36  void transmit_state() override;
38  bool on_receive(remote_base::RemoteReceiveData data) override;
39 
40  bool send_swing_cmd_{false};
41 
42  void calc_checksum_(uint32_t &value);
43  void transmit_(uint32_t value);
44 
45  uint32_t header_high_;
46  uint32_t header_low_;
47  uint32_t bit_high_;
48  uint32_t bit_one_low_;
49  uint32_t bit_zero_low_;
50 
52 };
53 
54 } // namespace climate_ir_lg
55 } // 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:51
ClimateSwingMode swing_mode
The active swing mode of the climate device.
Definition: climate.h:204
const uint8_t TEMP_MIN
Definition: climate_ir_lg.h:9
void set_header_low(uint32_t header_low)
Definition: climate_ir_lg.h:29
const optional< ClimateMode > & get_mode() const
Definition: climate.cpp:259
void set_bit_one_low(uint32_t bit_one_low)
Definition: climate_ir_lg.h:31
void set_header_high(uint32_t header_high)
Definition: climate_ir_lg.h:28
void set_bit_zero_low(uint32_t bit_zero_low)
Definition: climate_ir_lg.h:32
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:59
void set_bit_high(uint32_t bit_high)
Definition: climate_ir_lg.h:30
The fan mode is set to Auto.
Definition: climate_mode.h:52
void calc_checksum_(uint32_t &value)
The fan mode is set to Vertical.
Definition: climate_mode.h:74
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:70
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:21
const optional< ClimateSwingMode > & get_swing_mode() const
Definition: climate.cpp:272
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4
const uint8_t TEMP_MAX
Definition: climate_ir_lg.h:10
The fan mode is set to Medium.
Definition: climate_mode.h:56
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={})
Definition: climate_ir.h:23