9 #include <protocol/haier_protocol.h> 35 public haier_protocol::ProtocolStream {
50 void setup()
override;
53 void dump_config()
override;
55 void set_display_state(
bool state);
56 bool get_display_state()
const;
57 void set_health_mode(
bool state);
58 bool get_health_mode()
const;
59 void send_power_on_command();
60 void send_power_off_command();
63 void set_supported_modes(
const std::set<esphome::climate::ClimateMode> &modes);
64 void set_supported_swing_modes(
const std::set<esphome::climate::ClimateSwingMode> &modes);
65 void set_supported_presets(
const std::set<esphome::climate::ClimatePreset> &presets);
74 bool can_send_message()
const {
return haier_protocol_.get_outgoing_queue_size() == 0; };
75 void set_answer_timeout(uint32_t timeout);
76 void set_send_wifi(
bool send_wifi);
77 void send_custom_command(
const haier_protocol::HaierMessage &message);
78 void add_status_message_callback(std::function<
void(
const char *,
size_t)> &&callback);
86 SENDING_FIRST_STATUS_REQUEST,
87 SENDING_FIRST_ALARM_STATUS_REQUEST,
90 SENDING_STATUS_REQUEST,
91 SENDING_UPDATE_SIGNAL_REQUEST,
94 SENDING_ACTION_COMMAND,
95 SENDING_ALARM_STATUS_REQUEST,
99 virtual void set_handlers() = 0;
100 virtual void process_phase(std::chrono::steady_clock::time_point now) = 0;
101 virtual haier_protocol::HaierMessage get_control_message() = 0;
102 virtual haier_protocol::HaierMessage get_power_message(
bool state) = 0;
103 virtual void save_settings();
104 virtual void initialization();
105 virtual bool prepare_pending_action();
106 virtual void process_protocol_reset();
109 haier_protocol::HandlerError answer_preprocess_(haier_protocol::FrameType request_message_type,
110 haier_protocol::FrameType expected_request_message_type,
111 haier_protocol::FrameType answer_message_type,
112 haier_protocol::FrameType expected_answer_message_type,
114 haier_protocol::HandlerError report_network_status_answer_handler_(haier_protocol::FrameType request_type,
115 haier_protocol::FrameType message_type,
118 haier_protocol::HandlerError timeout_default_handler_(haier_protocol::FrameType request_type);
120 void send_message_(
const haier_protocol::HaierMessage &command,
bool use_crc, uint8_t num_repeats = 0,
121 std::chrono::milliseconds interval = std::chrono::milliseconds::zero());
124 void reset_to_idle_();
125 bool is_message_interval_exceeded_(std::chrono::steady_clock::time_point now);
126 bool is_status_request_interval_exceeded_(std::chrono::steady_clock::time_point now);
127 bool is_control_message_interval_exceeded_(std::chrono::steady_clock::time_point now);
128 bool is_protocol_initialisation_interval_exceeded_(std::chrono::steady_clock::time_point now);
130 haier_protocol::HaierMessage get_wifi_signal_message_();
170 std::unique_ptr<uint8_t[]> last_status_message_{
nullptr};
HvacSettings current_hvac_settings_
This class is used to encode all control actions on a climate device.
Base class for all switches.
bool can_send_message() const
esphome::optional< float > target_temperature
optional< std::array< uint8_t, N > > read_array()
void write_array(const uint8_t *data, size_t len)
esphome::optional< esphome::climate::ClimatePreset > preset
This class contains all static data for climate devices.
bool reset_protocol_request_
std::chrono::steady_clock::time_point last_status_request_
std::chrono::steady_clock::time_point last_signal_request_
esphome::optional< haier_protocol::HaierMessage > message
ESPPreferenceObject base_rtc_
void write_array(const uint8_t *data, size_t len) noexcept override
haier_protocol::ProtocolHandler haier_protocol_
size_t available() noexcept override
ProtocolPhases protocol_phase_
esphome::optional< PendingAction > action_request_
esphome::optional< esphome::climate::ClimateFanMode > fan_mode
void add_status_message_callback(std::function< void(const char *, size_t)> &&callback)
StatusMessageTrigger(HaierClimateBase *parent)
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
HvacSettings next_hvac_settings_
bool valid_connection() const
Implementation of SPI Controller mode.
std::chrono::steady_clock::time_point last_request_timestamp_
uint8_t other_modes_fan_speed_
size_t read_array(uint8_t *data, size_t len) noexcept override
float get_setup_priority() const override
esphome::climate::ClimateTraits traits_
bool forced_request_status_
esphome::optional< esphome::climate::ClimateSwingMode > swing_mode
ClimateDevice - This is the base class for all climate integrations.
std::chrono::steady_clock::time_point last_valid_status_timestamp_
esphome::optional< esphome::climate::ClimateMode > mode