14static const char *
const TAG =
"haier.climate";
49 if ((this->
mode != ClimateMode::CLIMATE_MODE_OFF) && (this->
mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) {
92 return "56°C Steri-Clean";
102 ESP_LOGI(TAG,
"Sending self cleaning start request");
110 ESP_LOGI(TAG,
"Sending steri cleaning start request");
117 haier_protocol::FrameType message_type,
118 const uint8_t *data,
size_t data_size) {
120 if (message_type == haier_protocol::FrameType::INVALID) {
121 ESP_LOGW(TAG,
"It looks like your ESPHome Haier climate configuration is wrong. You should use the smartAir2 "
122 "protocol instead of hOn");
124 return haier_protocol::HandlerError::INVALID_ANSWER;
126 haier_protocol::HandlerError result =
127 this->
answer_preprocess_(request_type, haier_protocol::FrameType::GET_DEVICE_VERSION, message_type,
129 if (result == haier_protocol::HandlerError::HANDLER_OK) {
132 return haier_protocol::HandlerError::WRONG_MESSAGE_STRUCTURE;
141 info.functions_[0] = (answr->
functions[1] & 0x01) != 0;
142 info.functions_[1] = (answr->
functions[1] & 0x02) != 0;
143 info.functions_[2] = (answr->
functions[1] & 0x04) != 0;
144 info.functions_[3] = (answr->
functions[1] & 0x08) != 0;
145 info.functions_[4] = (answr->
functions[1] & 0x20) != 0;
146 this->
use_crc_ = info.functions_[2];
147#ifdef USE_TEXT_SENSOR
161 haier_protocol::FrameType message_type,
162 const uint8_t *data,
size_t data_size) {
163 haier_protocol::HandlerError result =
164 this->
answer_preprocess_(request_type, haier_protocol::FrameType::GET_DEVICE_ID, message_type,
166 if (result == haier_protocol::HandlerError::HANDLER_OK) {
176 haier_protocol::FrameType message_type,
const uint8_t *data,
178 haier_protocol::HandlerError result =
179 this->
answer_preprocess_(request_type, haier_protocol::FrameType::CONTROL, message_type,
181 if (result == haier_protocol::HandlerError::HANDLER_OK) {
183 if (result != haier_protocol::HandlerError::HANDLER_OK) {
184 ESP_LOGW(TAG,
"Error %d while parsing Status packet", (
int) result);
197 this->real_control_packet_size_);
204 ESP_LOGI(TAG,
"First HVAC status received");
239 haier_protocol::FrameType request_type, haier_protocol::FrameType message_type,
const uint8_t *data,
242 request_type, haier_protocol::FrameType::GET_MANAGEMENT_INFORMATION, message_type,
244 if (result == haier_protocol::HandlerError::HANDLER_OK) {
254 haier_protocol::FrameType message_type,
255 const uint8_t *data,
size_t data_size) {
256 if (request_type == haier_protocol::FrameType::GET_ALARM_STATUS) {
257 if (message_type != haier_protocol::FrameType::GET_ALARM_STATUS_RESPONSE) {
260 return haier_protocol::HandlerError::UNSUPPORTED_MESSAGE;
266 return haier_protocol::HandlerError::UNEXPECTED_MESSAGE;
269 return haier_protocol::HandlerError::WRONG_MESSAGE_STRUCTURE;
272 return haier_protocol::HandlerError::HANDLER_OK;
275 return haier_protocol::HandlerError::UNSUPPORTED_MESSAGE;
280 const uint8_t *buffer,
size_t size) {
281 haier_protocol::HandlerError result = haier_protocol::HandlerError::HANDLER_OK;
284 result = haier_protocol::HandlerError::WRONG_MESSAGE_STRUCTURE;
287 this->
haier_protocol_.send_answer(haier_protocol::HaierMessage(haier_protocol::FrameType::CONFIRM));
295 haier_protocol::FrameType::GET_DEVICE_VERSION,
296 [
this](haier_protocol::FrameType req, haier_protocol::FrameType msg,
const uint8_t *data,
size_t size) {
300 haier_protocol::FrameType::GET_DEVICE_ID,
301 [
this](haier_protocol::FrameType req, haier_protocol::FrameType msg,
const uint8_t *data,
size_t size) {
305 haier_protocol::FrameType::CONTROL,
306 [
this](haier_protocol::FrameType req, haier_protocol::FrameType msg,
const uint8_t *data,
size_t size) {
310 haier_protocol::FrameType::GET_MANAGEMENT_INFORMATION,
311 [
this](haier_protocol::FrameType req, haier_protocol::FrameType msg,
const uint8_t *data,
size_t size) {
315 haier_protocol::FrameType::GET_ALARM_STATUS,
316 [
this](haier_protocol::FrameType req, haier_protocol::FrameType msg,
const uint8_t *data,
size_t size) {
320 haier_protocol::FrameType::REPORT_NETWORK_STATUS,
321 [
this](haier_protocol::FrameType req, haier_protocol::FrameType msg,
const uint8_t *data,
size_t size) {
324 this->
haier_protocol_.set_message_handler(haier_protocol::FrameType::ALARM_STATUS,
325 [
this](haier_protocol::FrameType
type,
const uint8_t *data,
size_t size) {
333 " Protocol version: hOn\n"
334 " Control method: %d",
338 " Device protocol version: %s\n"
339 " Device software version: %s\n"
340 " Device hardware version: %s\n"
343 this->hvac_hardware_info_.value().software_version_,
344 this->hvac_hardware_info_.value().hardware_version_, this->hvac_hardware_info_.value().device_name_);
345 ESP_LOGCONFIG(TAG,
" Device features:%s%s%s%s%s",
347 (this->hvac_hardware_info_.value().functions_[1] ?
" controller-device" :
""),
348 (this->hvac_hardware_info_.value().functions_[2] ?
" crc" :
""),
349 (this->hvac_hardware_info_.value().functions_[3] ?
" multinode" :
""),
350 (this->hvac_hardware_info_.value().functions_[4] ?
" role" :
""));
365 uint8_t module_capabilities[2] = {0b00000000, 0b00000111};
366 static const haier_protocol::HaierMessage DEVICE_VERSION_REQUEST(
367 haier_protocol::FrameType::GET_DEVICE_VERSION, module_capabilities,
sizeof(module_capabilities));
373 static const haier_protocol::HaierMessage DEVICEID_REQUEST(haier_protocol::FrameType::GET_DEVICE_ID);
380 static const haier_protocol::HaierMessage STATUS_REQUEST(
382 static const haier_protocol::HaierMessage BIG_DATA_REQUEST(
396 static const haier_protocol::HaierMessage UPDATE_SIGNAL_REQUEST(
397 haier_protocol::FrameType::GET_MANAGEMENT_INFORMATION);
416 static const haier_protocol::HaierMessage ALARM_STATUS_REQUEST(haier_protocol::FrameType::GET_ALARM_STATUS);
432 ESP_LOGI(TAG,
"AC control is disabled, monitor only");
436 ESP_LOGW(TAG,
"Unsupported control method for hOn protocol!");
442 ESP_LOGW(TAG,
"Control message queue is empty!");
461 ESP_LOGW(TAG,
"SENDING_ACTION_COMMAND phase without action request!");
469 }
else if (std::chrono::duration_cast<std::chrono::milliseconds>(now - this->
last_alarm_request_).count() >
475 (std::chrono::duration_cast<std::chrono::milliseconds>(now - this->
last_signal_request_).count() >
483 ESP_LOGE(TAG,
"Wrong protocol handler state: %s (%d), resetting communication",
492 static haier_protocol::HaierMessage power_on_message(
494 std::initializer_list<uint8_t>({0x00, 0x01}).begin(), 2);
495 return power_on_message;
497 static haier_protocol::HaierMessage power_off_message(
499 std::initializer_list<uint8_t>({0x00, 0x00}).begin(), 2);
500 return power_off_message;
506 constexpr uint32_t restore_settings_version = 0x57EB59DDUL;
520 uint8_t control_out_buffer[haier_protocol::MAX_FRAME_SIZE];
523 control_out_buffer[4] = 0;
524 bool has_hvac_settings =
false;
526 has_hvac_settings =
true;
528 if (climate_control.
mode.has_value()) {
529 switch (climate_control.
mode.value()) {
561 ESP_LOGE(
"Control",
"Unsupported climate mode");
566 if (climate_control.
fan_mode.has_value()) {
567 switch (climate_control.
fan_mode.value()) {
582 ESP_LOGE(
"Control",
"Unsupported fan mode");
609 out_data->
set_point = ((int) target_temp) - 16;
610 out_data->
half_degree = (target_temp - ((int) target_temp) >= 0.49) ? 1 : 0;
616 }
else if (climate_control.
preset.has_value()) {
617 switch (climate_control.
preset.value()) {
641 ESP_LOGE(
"Control",
"Unsupported preset");
673 return haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
679 constexpr size_t active_alarms_size =
sizeof(this->
active_alarms_);
680 if (size >= active_alarms_size + 2) {
682 size_t alarm_code = 0;
683 for (
int i = active_alarms_size - 1; i >= 0; i--) {
685 uint8_t alarm_bit = 1;
686 for (
int b = 0; b < 8; b++) {
687 if ((packet[2 + i] & alarm_bit) != (this->
active_alarms_[i] & alarm_bit)) {
688 bool alarm_status = (packet[2 + i] & alarm_bit) != 0;
689 int log_level = alarm_status ? ESPHOME_LOG_LEVEL_WARN : ESPHOME_LOG_LEVEL_INFO;
693 esp_log_printf_(log_level, TAG, __LINE__,
"Alarm %s (%d): %s", alarm_status ?
"activated" :
"deactivated",
694 alarm_code, alarm_message);
712 float alarm_count = 0.0f;
713 static uint8_t nibble_bits_count[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
715 alarm_count += (float) (nibble_bits_count[packet[2 + i] & 0x0F] + nibble_bits_count[packet[2 + i] >> 4]);
727 if ((this->
sub_sensors_[(
size_t) type] !=
nullptr) && (sens ==
nullptr)) {
729 }
else if ((this->
sub_sensors_[(
size_t) type] ==
nullptr) && (sens !=
nullptr)) {
739 size_t index = (size_t)
type;
747#ifdef USE_BINARY_SENSOR
761 bool converted_value = value == 1;
762 size_t index = (size_t)
type;
770#ifdef USE_TEXT_SENSOR
791 size_t index = (size_t)
type;
814 size_t expected_size =
816 if (size < expected_size) {
817 ESP_LOGW(TAG,
"Unexpected message size %u (expexted >= %zu)",
size, expected_size);
818 return haier_protocol::HandlerError::WRONG_MESSAGE_STRUCTURE;
820 uint16_t subtype = (((uint16_t) packet_buffer[0]) << 8) + packet_buffer[1];
839#ifdef USE_BINARY_SENSOR
853 memcpy(&packet.control, packet_buffer + 2 + this->status_message_header_size_,
855 memcpy(&packet.sensors, packet_buffer + 2 + this->status_message_header_size_ + this->real_control_packet_size_,
857 if (packet.sensors.error_status != 0) {
858 ESP_LOGW(TAG,
"HVAC error, code=0x%02X", packet.sensors.error_status);
871 bool should_publish =
false;
874 optional<ClimatePreset> old_preset = this->
preset;
875 if (packet.control.fast_mode != 0) {
877 }
else if (packet.control.sleep_mode != 0) {
879 }
else if (packet.control.ten_degree != 0) {
884 should_publish = should_publish || (!old_preset.has_value()) ||
890 this->
target_temperature = packet.control.set_point + 16.0f + ((packet.control.half_degree == 1) ? 0.5f : 0.0f);
891 should_publish = should_publish || (old_target_temperature != this->
target_temperature);
901 optional<ClimateFanMode> old_fan_mode = this->
fan_mode;
909 switch (packet.control.fan_mode) {
915 ESP_LOGI(TAG,
"Fan speed Auto is not supported in Fan only AC mode, ignoring");
928 should_publish = should_publish || (!old_fan_mode.has_value()) ||
933 if (packet.control.ac_power != 0) {
935 bool disp_status = packet.control.display_status != 0;
950 should_publish = should_publish || (old_health_mode != this->
get_health_mode());
954 if (packet.control.steri_clean == 1) {
957 }
else if (packet.control.self_cleaning_status == 1) {
965 ESP_LOGD(TAG,
"Cleaning status change: %d => %d", (uint8_t) this->
cleaning_status_, (uint8_t) new_cleaning);
971 this->cleaning_status_ = new_cleaning;
972#ifdef USE_TEXT_SENSOR
980 if (packet.control.ac_power == 0) {
984 switch (packet.control.ac_mode) {
1002 should_publish = should_publish || (old_mode != this->
mode);
1009 bool new_quiet_mode = packet.control.quiet_mode != 0;
1028 if (horizontal_swing_supported &&
1030 if (vertical_swing_supported &&
1037 if (vertical_swing_supported &&
1049 (this->current_vertical_swing_.value() != this->settings_.last_vertiacal_swing)) ||
1057 should_publish = should_publish || (old_swing_mode != this->
swing_mode);
1060 if (should_publish) {
1063 if (should_publish) {
1064 ESP_LOGI(TAG,
"HVAC values changed");
1066 int log_level = should_publish ? ESPHOME_LOG_LEVEL_INFO : ESPHOME_LOG_LEVEL_DEBUG;
1067 esp_log_printf_(log_level, TAG, __LINE__,
"HVAC Mode = 0x%X", packet.control.ac_mode);
1068 esp_log_printf_(log_level, TAG, __LINE__,
"Fan speed Status = 0x%X", packet.control.fan_mode);
1069 esp_log_printf_(log_level, TAG, __LINE__,
"Horizontal Swing Status = 0x%X", packet.control.horizontal_swing_mode);
1070 esp_log_printf_(log_level, TAG, __LINE__,
"Vertical Swing Status = 0x%X", packet.control.vertical_swing_mode);
1071 esp_log_printf_(log_level, TAG, __LINE__,
"Set Point Status = 0x%X", packet.control.set_point);
1072 return haier_protocol::HandlerError::HANDLER_OK;
1099 uint8_t fan_mode_buf[] = {0x00, 0xFF};
1100 uint8_t quiet_mode_buf[] = {0x00, 0xFF};
1101 if (climate_control.
mode.has_value()) {
1102 climate_mode = climate_control.
mode.value();
1103 uint8_t buffer[2] = {0x00, 0x00};
1104 switch (climate_control.
mode.value()) {
1154 ESP_LOGE(
"Control",
"Unsupported climate mode");
1167 uint8_t fast_mode_buf[] = {0x00, 0xFF};
1168 uint8_t away_mode_buf[] = {0x00, 0xFF};
1171 fast_mode_buf[1] = 0x00;
1172 away_mode_buf[1] = 0x00;
1173 }
else if (climate_control.
preset.has_value()) {
1174 switch (climate_control.
preset.value()) {
1176 fast_mode_buf[1] = 0x00;
1177 away_mode_buf[1] = 0x00;
1182 away_mode_buf[1] = 0x00;
1185 fast_mode_buf[1] = 0x00;
1189 ESP_LOGE(
"Control",
"Unsupported preset");
1196 quiet_mode_buf[1] = 0x01;
1198 quiet_mode_buf[1] = 0x00;
1204 if (quiet_mode_buf[1] != 0xFF) {
1224 if (climate_control.
target_temperature.has_value() && (this->mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) {
1225 uint8_t buffer[2] = {0x00, 0x00};
1233 if (climate_control.
swing_mode.has_value()) {
1236 switch (climate_control.
swing_mode.value()) {
1253 horizontal_swing_buf, 2);
1257 vertical_swing_buf, 2);
1260 if (climate_control.
fan_mode.has_value()) {
1261 switch (climate_control.
fan_mode.value()) {
1276 ESP_LOGE(
"Control",
"Unsupported fan mode");
1279 if (fan_mode_buf[1] != 0xFF) {
1295 switch (action_request.action) {
1298 uint8_t control_out_buffer[haier_protocol::MAX_FRAME_SIZE];
1309 action_request.message = haier_protocol::HaierMessage(
1314 action_request.message =
1315 haier_protocol::HaierMessage(haier_protocol::FrameType::CONTROL,
1326 uint8_t control_out_buffer[haier_protocol::MAX_FRAME_SIZE];
1337 action_request.message = haier_protocol::HaierMessage(
1355 if ((sub_sensor !=
nullptr) && sub_sensor->has_state())
1356 sub_sensor->publish_state(NAN);
ESPPreferenceObject make_entity_preference(uint32_t version=0)
Create a preference object for storing this entity's state/settings.
constexpr size_t count(ValueType value) const
Check if the set contains a specific value (std::set compatibility) Returns 1 if present,...
Base class for all binary_sensor-type classes.
void publish_state(bool new_state)
Publish a new state to the front-end.
ClimateMode mode
The active mode of the climate device.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
float target_temperature
The target temperature of the climate device.
ClimateSwingMode swing_mode
The active swing mode of the climate device.
float current_temperature
The current temperature of the climate device, as reported from the integration.
void publish_state()
Publish the state of the climate device, to be called from integrations.
optional< ClimatePreset > preset
The active preset of the climate device.
const ClimatePresetMask & get_supported_presets() const
const ClimateSwingModeMask & get_supported_swing_modes() const
ProtocolPhases protocol_phase_
SwitchState display_status_
esphome::climate::ClimateTraits traits_
bool get_health_mode() const
bool is_message_interval_exceeded_(std::chrono::steady_clock::time_point now)
CallbackManager< void(const char *, size_t)> status_message_callback_
bool forced_request_status_
bool is_protocol_initialisation_interval_exceeded_(std::chrono::steady_clock::time_point now)
bool is_status_request_interval_exceeded_(std::chrono::steady_clock::time_point now)
haier_protocol::HandlerError answer_preprocess_(haier_protocol::FrameType request_message_type, haier_protocol::FrameType expected_request_message_type, haier_protocol::FrameType answer_message_type, haier_protocol::FrameType expected_answer_message_type, ProtocolPhases expected_phase)
virtual void initialization()
virtual void save_settings()
haier_protocol::ProtocolHandler haier_protocol_
virtual void process_protocol_reset()
const char * phase_to_string_(ProtocolPhases phase)
@ SENDING_UPDATE_SIGNAL_REQUEST
@ SENDING_ALARM_STATUS_REQUEST
@ SENDING_FIRST_STATUS_REQUEST
@ SENDING_FIRST_ALARM_STATUS_REQUEST
std::unique_ptr< uint8_t[]> last_status_message_
void send_message_(const haier_protocol::HaierMessage &command, bool use_crc, uint8_t num_repeats=0, std::chrono::milliseconds interval=std::chrono::milliseconds::zero())
haier_protocol::HandlerError report_network_status_answer_handler_(haier_protocol::FrameType request_type, haier_protocol::FrameType message_type, const uint8_t *data, size_t data_size)
void control(const esphome::climate::ClimateCall &call) override
bool can_send_message() const
virtual bool prepare_pending_action()
bool get_display_state() const
std::chrono::steady_clock::time_point last_valid_status_timestamp_
haier_protocol::HaierMessage get_wifi_signal_message_()
bool is_control_message_interval_exceeded_(std::chrono::steady_clock::time_point now)
uint8_t other_modes_fan_speed_
esphome::optional< PendingAction > action_request_
std::chrono::steady_clock::time_point last_status_request_
HvacSettings current_hvac_settings_
void dump_config() override
virtual void set_phase(ProtocolPhases phase)
std::chrono::steady_clock::time_point last_signal_request_
void set_quiet_mode_switch(switch_::Switch *sw)
bool should_get_big_data_()
void dump_config() override
esphome::optional< hon_protocol::VerticalSwingMode > get_vertical_airflow() const
ESPPreferenceObject hon_rtc_
void set_sub_text_sensor(SubTextSensorType type, text_sensor::TextSensor *sens)
uint8_t active_alarms_[8]
haier_protocol::HandlerError status_handler_(haier_protocol::FrameType request_type, haier_protocol::FrameType message_type, const uint8_t *data, size_t data_size)
HonControlMethod control_method_
void initialization() override
haier_protocol::HandlerError get_device_id_answer_handler_(haier_protocol::FrameType request_type, haier_protocol::FrameType message_type, const uint8_t *data, size_t data_size)
int extra_control_packet_bytes_
CallbackManager< void(uint8_t, const char *)> alarm_end_callback_
esphome::optional< HardwareInfo > hvac_hardware_info_
void set_sub_sensor(SubSensorType type, sensor::Sensor *sens)
void set_handlers() override
CallbackManager< void(uint8_t, const char *)> alarm_start_callback_
void update_sub_sensor_(SubSensorType type, float value)
void set_sub_binary_sensor(SubBinarySensorType type, binary_sensor::BinarySensor *sens)
haier_protocol::HaierMessage get_power_message(bool state) override
bool got_valid_outdoor_temp_
text_sensor::TextSensor * sub_text_sensors_[(size_t) SubTextSensorType::SUB_TEXT_SENSOR_TYPE_COUNT]
haier_protocol::HandlerError get_alarm_status_answer_handler_(haier_protocol::FrameType request_type, haier_protocol::FrameType message_type, const uint8_t *data, size_t data_size)
int status_message_header_size_
switch_::Switch * beeper_switch_
std::chrono::steady_clock::time_point last_alarm_request_
void start_steri_cleaning()
sensor::Sensor * sub_sensors_[(size_t) SubSensorType::SUB_SENSOR_TYPE_COUNT]
void set_beeper_state(bool state)
uint8_t big_data_counter_
size_t real_control_packet_size_
int real_sensors_packet_size_
void set_horizontal_airflow(hon_protocol::HorizontalSwingMode direction)
haier_protocol::HandlerError process_status_message_(const uint8_t *packet, uint8_t size)
@ SUB_BINARY_SENSOR_TYPE_COUNT
@ INDOOR_ELECTRIC_HEATING_STATUS
void start_self_cleaning()
void set_vertical_airflow(hon_protocol::VerticalSwingMode direction)
bool get_beeper_state() const
CleaningState cleaning_status_
haier_protocol::HandlerError get_management_information_answer_handler_(haier_protocol::FrameType request_type, haier_protocol::FrameType message_type, const uint8_t *data, size_t data_size)
std::queue< haier_protocol::HaierMessage > control_messages_queue_
esphome::optional< hon_protocol::HorizontalSwingMode > current_horizontal_swing_
void set_quiet_mode_state(bool state)
haier_protocol::HandlerError get_device_version_answer_handler_(haier_protocol::FrameType request_type, haier_protocol::FrameType message_type, const uint8_t *data, size_t data_size)
binary_sensor::BinarySensor * sub_binary_sensors_[(size_t) SubBinarySensorType::SUB_BINARY_SENSOR_TYPE_COUNT]
haier_protocol::HandlerError alarm_status_message_handler_(haier_protocol::FrameType type, const uint8_t *buffer, size_t size)
void clear_control_messages_queue_()
float active_alarm_count_
const char * get_cleaning_status_text() const
void update_sub_binary_sensor_(SubBinarySensorType type, uint8_t value)
haier_protocol::HaierMessage get_control_message() override
void process_phase(std::chrono::steady_clock::time_point now) override
esphome::optional< hon_protocol::HorizontalSwingMode > pending_horizontal_direction_
static constexpr size_t HARDWARE_INFO_STR_SIZE
bool get_quiet_mode_state() const
switch_::Switch * quiet_mode_switch_
void process_protocol_reset() override
int extra_sensors_packet_bytes_
CleaningState get_cleaning_status() const
esphome::optional< hon_protocol::HorizontalSwingMode > get_horizontal_airflow() const
SwitchState quiet_mode_state_
void fill_control_messages_queue_()
void set_beeper_switch(switch_::Switch *sw)
esphome::optional< hon_protocol::VerticalSwingMode > current_vertical_swing_
@ BIG_DATA_FRAME_SUB_SENSORS
@ EXPANSION_VALVE_OPEN_DEGREE
@ OUTDOOR_IN_AIR_TEMPERATURE
@ INDOOR_COIL_TEMPERATURE
@ OUTDOOR_COIL_TEMPERATURE
@ OUTDOOR_OUT_AIR_TEMPERATURE
@ OUTDOOR_DEFROST_TEMPERATURE
void update_sub_text_sensor_(SubTextSensorType type, const char *value)
void process_alarm_message_(const uint8_t *packet, uint8_t size, bool check_new)
bool prepare_pending_action() override
esphome::optional< hon_protocol::VerticalSwingMode > pending_vertical_direction_
Base-class for all sensors.
void publish_state(float state)
Publish a new state to the front-end.
Base class for all switches.
void publish_state(bool state)
Publish a state to the front-end from the back-end.
void publish_state(const std::string &state)
@ CLIMATE_PRESET_NONE
No preset is active.
@ CLIMATE_PRESET_AWAY
Device is in away preset.
@ CLIMATE_PRESET_BOOST
Device is in boost preset.
@ CLIMATE_PRESET_SLEEP
Device is prepared for sleep.
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.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
ClimateMode
Enum for all modes a climate device can be in.
@ CLIMATE_MODE_DRY
The climate device is set to dry/humidity mode.
@ CLIMATE_MODE_FAN_ONLY
The climate device only has the fan enabled, no heating or cooling is taking place.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_COOL
The climate device is set to cool to reach the target temperature.
@ CLIMATE_MODE_HEAT_COOL
The climate device is set to heat/cool to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_ON
The fan mode is set to On.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
const std::string HON_ALARM_MESSAGES[]
constexpr size_t HON_ALARM_COUNT
constexpr uint8_t CONTROL_MESSAGE_RETRIES
constexpr size_t ALARM_STATUS_REQUEST_INTERVAL_MS
constexpr std::chrono::milliseconds CONTROL_MESSAGE_RETRIES_INTERVAL
constexpr int PROTOCOL_OUTDOOR_TEMPERATURE_OFFSET
constexpr size_t SIGNAL_LEVEL_UPDATE_INTERVAL_MS
void HOT esp_log_printf_(int level, const char *tag, int line, const char *format,...)
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
esphome::optional< esphome::climate::ClimateFanMode > fan_mode
esphome::optional< esphome::climate::ClimateSwingMode > swing_mode
esphome::optional< esphome::climate::ClimateMode > mode
esphome::optional< esphome::climate::ClimatePreset > preset
esphome::optional< float > target_temperature
hon_protocol::HorizontalSwingMode last_horizontal_swing
hon_protocol::VerticalSwingMode last_vertiacal_swing
uint8_t compressor_status
uint8_t indoor_coil_temperature
uint8_t outdoor_coil_temperature
uint8_t compressor_frequency
uint8_t four_way_valve_status
uint8_t expansion_valve_open_degree[2]
uint8_t outdoor_in_air_temperature
uint8_t indoor_electric_heating_status
uint8_t outdoor_out_air_temperature
uint8_t compressor_current[2]
uint8_t outdoor_fan_status
uint8_t indoor_fan_status
uint8_t vertical_swing_mode
uint8_t self_cleaning_status
uint8_t horizontal_swing_mode