ESPHome 2025.5.0
Loading...
Searching...
No Matches
climate_ir_lg.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <cinttypes>
6
7namespace esphome {
8namespace climate_ir_lg {
9
10// Temperature
11const uint8_t TEMP_MIN = 18; // Celsius
12const uint8_t TEMP_MAX = 30; // Celsius
13
15 public:
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;
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
const optional< ClimateSwingMode > & get_swing_mode() const
Definition climate.cpp:282
ClimateSwingMode swing_mode
The active swing mode of the climate device.
Definition climate.h:202
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
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
void set_bit_high(uint32_t bit_high)
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
void set_header_high(uint32_t header_high)
void transmit_state() override
Transmit via IR the state of this climate controller.
void set_bit_zero_low(uint32_t bit_zero_low)
void set_header_low(uint32_t header_low)
void set_bit_one_low(uint32_t bit_one_low)
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
bool has_value() const
Definition optional.h:87
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
ClimateMode
Enum for all modes a climate device can be in.
@ 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.
Definition a01nyub.cpp:7