ESPHome  2024.11.0
midea_ir.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "midea_data.h"
5 
6 namespace esphome {
7 namespace midea_ir {
8 
9 // Temperature
10 const uint8_t MIDEA_TEMPC_MIN = 17; // Celsius
11 const uint8_t MIDEA_TEMPC_MAX = 30; // Celsius
12 const uint8_t MIDEA_TEMPF_MIN = 62; // Fahrenheit
13 const uint8_t MIDEA_TEMPF_MAX = 86; // Fahrenheit
14 
16  public:
18  : climate_ir::ClimateIR(
19  MIDEA_TEMPC_MIN, MIDEA_TEMPC_MAX, 1.0f, true, true,
24 
26  void control(const climate::ClimateCall &call) override;
27 
29  void set_fahrenheit(bool value) {
30  this->fahrenheit_ = value;
31  this->temperature_step_ = value ? 0.5f : 1.0f;
32  }
33 
34  protected:
36  void transmit_state() override;
37  void transmit_(MideaData &data);
39  bool on_receive(remote_base::RemoteReceiveData data) override;
40  bool on_midea_(const MideaData &data);
41  bool fahrenheit_{false};
42  bool swing_{false};
43  bool boost_{false};
44 };
45 
46 } // namespace midea_ir
47 } // 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
void transmit_state() override
Transmit via IR the state of this climate controller.
Definition: midea_ir.cpp:137
const uint8_t MIDEA_TEMPF_MIN
Definition: midea_ir.h:12
const uint8_t MIDEA_TEMPC_MAX
Definition: midea_ir.h:11
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
Definition: midea_ir.cpp:112
Device is prepared for sleep.
Definition: climate_mode.h:96
void transmit_(MideaData &data)
Definition: midea_ir.cpp:130
The fan mode is set to Auto.
Definition: climate_mode.h:52
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
The fan mode is set to High.
Definition: climate_mode.h:58
The swing mode is set to Off.
Definition: climate_mode.h:72
void set_fahrenheit(bool value)
Set use of Fahrenheit units.
Definition: midea_ir.h:29
Device is in boost preset.
Definition: climate_mode.h:90
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
const uint8_t MIDEA_TEMPC_MIN
Definition: midea_ir.h:10
The fan mode is set to Medium.
Definition: climate_mode.h:56
bool on_midea_(const MideaData &data)
Definition: midea_ir.cpp:167
const uint8_t MIDEA_TEMPF_MAX
Definition: midea_ir.h:13
bool on_receive(remote_base::RemoteReceiveData data) override
Handle received IR Buffer.
Definition: midea_ir.cpp:160