ESPHome  2024.12.2
toshiba.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace esphome {
6 namespace toshiba {
7 
8 // Simple enum to represent models.
9 enum Model {
10  MODEL_GENERIC = 0, // Temperature range is from 17 to 30
11  MODEL_RAC_PT1411HWRU_C = 1, // Temperature range is from 16 to 30
12  MODEL_RAC_PT1411HWRU_F = 2, // Temperature range is from 16 to 30
13 };
14 
15 // Supported temperature ranges
16 const float TOSHIBA_GENERIC_TEMP_C_MIN = 17.0;
17 const float TOSHIBA_GENERIC_TEMP_C_MAX = 30.0;
22 
24  public:
26  : climate_ir::ClimateIR(TOSHIBA_GENERIC_TEMP_C_MIN, TOSHIBA_GENERIC_TEMP_C_MAX, 1.0f, true, true,
29 
30  void setup() override;
31  void set_model(Model model) { this->model_ = model; }
32 
33  protected:
34  void transmit_state() override;
35  void transmit_generic_();
37  void transmit_rac_pt1411hwru_temp_(bool cs_state = true, bool cs_send_update = true);
38  // Returns the header if valid, else returns zero
39  uint8_t is_valid_rac_pt1411hwru_header_(const uint8_t *message);
40  // Returns true if message is a valid RAC-PT1411HWRU IR message, regardless if first or second packet
41  bool is_valid_rac_pt1411hwru_message_(const uint8_t *message);
42  // Returns true if message1 and message 2 are the same
43  bool compare_rac_pt1411hwru_packets_(const uint8_t *message1, const uint8_t *message2);
44  bool on_receive(remote_base::RemoteReceiveData data) override;
45 
46  float temperature_min_() {
48  }
49  float temperature_max_() {
51  }
52  std::set<climate::ClimateSwingMode> toshiba_swing_modes_() {
53  return (this->model_ == MODEL_GENERIC)
54  ? std::set<climate::ClimateSwingMode>{}
55  : std::set<climate::ClimateSwingMode>{climate::CLIMATE_SWING_OFF, climate::CLIMATE_SWING_VERTICAL};
56  }
57  void encode_(remote_base::RemoteTransmitData *data, const uint8_t *message, uint8_t nbytes, uint8_t repeat);
58  bool decode_(remote_base::RemoteReceiveData *data, uint8_t *message, uint8_t nbytes);
59 
61 };
62 
63 } // namespace toshiba
64 } // 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
const float TOSHIBA_RAC_PT1411HWRU_TEMP_C_MAX
Definition: toshiba.h:19
bool decode_(remote_base::RemoteReceiveData *data, uint8_t *message, uint8_t nbytes)
Definition: toshiba.cpp:752
void transmit_state() override
Definition: toshiba.cpp:133
const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MAX
Definition: toshiba.h:21
void transmit_rac_pt1411hwru_temp_(bool cs_state=true, bool cs_send_update=true)
Definition: toshiba.cpp:384
bool on_receive(remote_base::RemoteReceiveData data) override
Definition: toshiba.cpp:492
void set_model(Model model)
Definition: toshiba.h:31
const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MIN
Definition: toshiba.h:20
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
std::set< climate::ClimateSwingMode > toshiba_swing_modes_()
Definition: toshiba.h:52
bool is_valid_rac_pt1411hwru_message_(const uint8_t *message)
Definition: toshiba.cpp:463
The fan mode is set to Vertical.
Definition: climate_mode.h:76
void encode_(remote_base::RemoteTransmitData *data, const uint8_t *message, uint8_t nbytes, uint8_t repeat)
Definition: toshiba.cpp:731
The fan mode is set to High.
Definition: climate_mode.h:58
The swing mode is set to Off.
Definition: climate_mode.h:72
const float TOSHIBA_RAC_PT1411HWRU_TEMP_C_MIN
Definition: toshiba.h:18
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
The fan mode is set to Medium.
Definition: climate_mode.h:56
const float TOSHIBA_GENERIC_TEMP_C_MAX
Definition: toshiba.h:17
const float TOSHIBA_GENERIC_TEMP_C_MIN
Definition: toshiba.h:16
bool compare_rac_pt1411hwru_packets_(const uint8_t *message1, const uint8_t *message2)
Definition: toshiba.cpp:455
uint8_t is_valid_rac_pt1411hwru_header_(const uint8_t *message)
Definition: toshiba.cpp:441