ESPHome  2024.11.0
mitsubishi.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <cinttypes>
6 
7 namespace esphome {
8 namespace mitsubishi {
9 
10 // Temperature
11 const uint8_t MITSUBISHI_TEMP_MIN = 16; // Celsius
12 const uint8_t MITSUBISHI_TEMP_MAX = 31; // Celsius
13 
14 // Fan mode
15 enum SetFanMode {
16  MITSUBISHI_FAN_3L = 0, // 3 levels + auto
17  MITSUBISHI_FAN_4L, // 4 levels + auto
18  MITSUBISHI_FAN_Q4L, // Quiet + 4 levels + auto
19  // MITSUBISHI_FAN_5L, // 5 levels + auto
20 };
21 
22 // Enum to represent horizontal directios
30 };
31 
32 // Enum to represent vertical directions
40 };
41 
43  public:
45  : climate_ir::ClimateIR(MITSUBISHI_TEMP_MIN, MITSUBISHI_TEMP_MAX, 1.0f, true, true,
52 
53  void set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
54  void set_supports_dry(bool supports_dry) { this->supports_dry_ = supports_dry; }
55  void set_supports_fan_only(bool supports_fan_only) { this->supports_fan_only_ = supports_fan_only; }
56  void set_supports_heat(bool supports_heat) { this->supports_heat_ = supports_heat; }
57 
59 
60  void set_horizontal_default(HorizontalDirection horizontal_direction) {
61  this->default_horizontal_direction_ = horizontal_direction;
62  }
63  void set_vertical_default(VerticalDirection vertical_direction) {
64  this->default_vertical_direction_ = vertical_direction;
65  }
66 
67  protected:
68  // Transmit via IR the state of this climate controller.
69  void transmit_state() override;
70  // Handle received IR Buffer
71  bool on_receive(remote_base::RemoteReceiveData data) override;
72  bool parse_state_frame_(const uint8_t frame[]);
73 
75 
78 
79  climate::ClimateTraits traits() override;
80 };
81 
82 } // namespace mitsubishi
83 } // namespace esphome
The fan mode is set to Low.
Definition: climate_mode.h:54
The fan mode is set to Quiet.
Definition: climate_mode.h:66
bool parse_state_frame_(const uint8_t frame[])
Definition: mitsubishi.cpp:282
The fan mode is set to Both.
Definition: climate_mode.h:74
The fan mode is set to Middle.
Definition: climate_mode.h:60
void set_supports_dry(bool supports_dry)
Definition: mitsubishi.h:54
This class contains all static data for climate devices.
climate::ClimateTraits traits() override
Definition: mitsubishi.cpp:53
Device is prepared for sleep.
Definition: climate_mode.h:96
bool on_receive(remote_base::RemoteReceiveData data) override
Definition: mitsubishi.cpp:284
HorizontalDirection default_horizontal_direction_
Definition: mitsubishi.h:76
The fan mode is set to Horizontal.
Definition: climate_mode.h:78
The fan mode is set to Auto.
Definition: climate_mode.h:52
const uint8_t MITSUBISHI_TEMP_MAX
Definition: mitsubishi.h:12
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_supports_heat(bool supports_heat)
Definition: mitsubishi.h:56
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
Definition: climate.h:199
void set_supports_cool(bool supports_cool)
Definition: mitsubishi.h:53
void set_vertical_default(VerticalDirection vertical_direction)
Definition: mitsubishi.h:63
Device is in boost preset.
Definition: climate_mode.h:90
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_supports_fan_only(bool supports_fan_only)
Definition: mitsubishi.h:55
Device is running an energy-saving preset.
Definition: climate_mode.h:94
const uint8_t MITSUBISHI_TEMP_MIN
Definition: mitsubishi.h:11
The fan mode is set to Medium.
Definition: climate_mode.h:56
VerticalDirection default_vertical_direction_
Definition: mitsubishi.h:77
void set_fan_mode(SetFanMode fan_mode)
Definition: mitsubishi.h:58
void set_horizontal_default(HorizontalDirection horizontal_direction)
Definition: mitsubishi.h:60