ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
toshiba.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace esphome {
7namespace toshiba {
8
9// Simple enum to represent models.
10enum Model {
11 MODEL_GENERIC = 0, // Temperature range is from 17 to 30
12 MODEL_RAC_PT1411HWRU_C = 1, // Temperature range is from 16 to 30
13 MODEL_RAC_PT1411HWRU_F = 2, // Temperature range is from 16 to 30
14 MODEL_RAS_2819T = 3, // RAS-2819T protocol variant, temperature range 18 to 30
15};
16
17// Supported temperature ranges
18const float TOSHIBA_GENERIC_TEMP_C_MIN = 17.0;
19const float TOSHIBA_GENERIC_TEMP_C_MAX = 30.0;
26
28 public:
33
34 void setup() override;
35 void set_model(Model model) { this->model_ = model; }
36
37 protected:
38 void transmit_state() override;
39 void transmit_generic_();
41 void transmit_rac_pt1411hwru_temp_(bool cs_state = true, bool cs_send_update = true);
43 // Process RAS-2819T IR command data
45 // Returns the header if valid, else returns zero
46 uint8_t is_valid_rac_pt1411hwru_header_(const uint8_t *message);
47 // Returns true if message is a valid RAC-PT1411HWRU IR message, regardless if first or second packet
48 bool is_valid_rac_pt1411hwru_message_(const uint8_t *message);
49 // Returns true if message1 and message 2 are the same
50 bool compare_rac_pt1411hwru_packets_(const uint8_t *message1, const uint8_t *message2);
52
53 private:
54 // RAS-2819T state tracking for swing mode optimization
57 optional<climate::ClimateFanMode> last_fan_mode_{};
58 float last_target_temperature_{24.0f};
59
60 float temperature_min_() {
61 if (this->model_ == MODEL_RAC_PT1411HWRU_C || this->model_ == MODEL_RAC_PT1411HWRU_F)
63 if (this->model_ == MODEL_RAS_2819T)
65 return TOSHIBA_GENERIC_TEMP_C_MIN; // Default to GENERIC for unknown models
66 }
67 float temperature_max_() {
68 if (this->model_ == MODEL_RAC_PT1411HWRU_C || this->model_ == MODEL_RAC_PT1411HWRU_F)
70 if (this->model_ == MODEL_RAS_2819T)
72 return TOSHIBA_GENERIC_TEMP_C_MAX; // Default to GENERIC for unknown models
73 }
74 climate::ClimateSwingModeMask toshiba_swing_modes_() {
75 return (this->model_ == MODEL_GENERIC)
78 }
79 void encode_(remote_base::RemoteTransmitData *data, const uint8_t *message, uint8_t nbytes, uint8_t repeat);
80 bool decode_(remote_base::RemoteReceiveData *data, uint8_t *message, uint8_t nbytes);
81
82 Model model_;
83};
84
85} // namespace toshiba
86} // namespace esphome
ClimateIR(float minimum_temperature, float maximum_temperature, float temperature_step=1.0f, bool supports_dry=false, bool supports_fan_only=false, climate::ClimateFanModeMask fan_modes=climate::ClimateFanModeMask(), climate::ClimateSwingModeMask swing_modes=climate::ClimateSwingModeMask(), climate::ClimatePresetMask presets=climate::ClimatePresetMask())
Definition climate_ir.h:26
bool compare_rac_pt1411hwru_packets_(const uint8_t *message1, const uint8_t *message2)
Definition toshiba.cpp:959
bool is_valid_rac_pt1411hwru_message_(const uint8_t *message)
Definition toshiba.cpp:967
uint8_t is_valid_rac_pt1411hwru_header_(const uint8_t *message)
Definition toshiba.cpp:945
void set_model(Model model)
Definition toshiba.h:35
bool process_ras_2819t_command_(const remote_base::ToshibaAcData &toshiba_data)
Definition toshiba.cpp:996
void transmit_rac_pt1411hwru_temp_(bool cs_state=true, bool cs_send_update=true)
Definition toshiba.cpp:686
bool on_receive(remote_base::RemoteReceiveData data) override
Definition toshiba.cpp:1079
const char * message
Definition component.cpp:38
FiniteSetMask< ClimateSwingMode, DefaultBitPolicy< ClimateSwingMode, CLIMATE_SWING_HORIZONTAL+1 > > ClimateSwingModeMask
ClimateSwingMode
Enum for all modes a climate swing can be in NOTE: If adding values, update ClimateSwingModeMask in c...
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
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_QUIET
The fan mode is set to Quiet.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
@ MODEL_RAC_PT1411HWRU_C
Definition toshiba.h:12
@ MODEL_RAC_PT1411HWRU_F
Definition toshiba.h:13
const float TOSHIBA_RAS_2819T_TEMP_C_MAX
Definition toshiba.h:25
const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MIN
Definition toshiba.h:22
const float TOSHIBA_GENERIC_TEMP_C_MAX
Definition toshiba.h:19
const float TOSHIBA_GENERIC_TEMP_C_MIN
Definition toshiba.h:18
const float TOSHIBA_RAC_PT1411HWRU_TEMP_C_MAX
Definition toshiba.h:21
const float TOSHIBA_RAS_2819T_TEMP_C_MIN
Definition toshiba.h:24
const float TOSHIBA_RAC_PT1411HWRU_TEMP_C_MIN
Definition toshiba.h:20
const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MAX
Definition toshiba.h:23
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7