mirror of
https://github.com/esphome/esphome.git
synced 2024-12-18 03:24:54 +01:00
rollback
This commit is contained in:
parent
04e3acbb14
commit
07cb903334
5 changed files with 13 additions and 13 deletions
|
@ -310,13 +310,13 @@ bool HaierClimateBase::prepare_pending_action() {
|
||||||
case ActionRequest::SEND_CUSTOM_COMMAND:
|
case ActionRequest::SEND_CUSTOM_COMMAND:
|
||||||
return true;
|
return true;
|
||||||
case ActionRequest::TURN_POWER_ON:
|
case ActionRequest::TURN_POWER_ON:
|
||||||
this->action_request_.value().message = this->get_power_message_(true);
|
this->action_request_.value().message = this->get_power_message(true);
|
||||||
return true;
|
return true;
|
||||||
case ActionRequest::TURN_POWER_OFF:
|
case ActionRequest::TURN_POWER_OFF:
|
||||||
this->action_request_.value().message = this->get_power_message_(false);
|
this->action_request_.value().message = this->get_power_message(false);
|
||||||
return true;
|
return true;
|
||||||
case ActionRequest::TOGGLE_POWER:
|
case ActionRequest::TOGGLE_POWER:
|
||||||
this->action_request_.value().message = this->get_power_message_(this->mode == ClimateMode::CLIMATE_MODE_OFF);
|
this->action_request_.value().message = this->get_power_message(this->mode == ClimateMode::CLIMATE_MODE_OFF);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
ESP_LOGW(TAG, "Unsupported action: %d", (uint8_t) this->action_request_.value().action);
|
ESP_LOGW(TAG, "Unsupported action: %d", (uint8_t) this->action_request_.value().action);
|
||||||
|
|
|
@ -394,7 +394,7 @@ void HonClimate::process_phase(std::chrono::steady_clock::time_point now) {
|
||||||
if (this->control_messages_queue_.empty()) {
|
if (this->control_messages_queue_.empty()) {
|
||||||
switch (this->control_method_) {
|
switch (this->control_method_) {
|
||||||
case HonControlMethod::SET_GROUP_PARAMETERS: {
|
case HonControlMethod::SET_GROUP_PARAMETERS: {
|
||||||
haier_protocol::HaierMessage control_message = this->get_control_message_();
|
haier_protocol::HaierMessage control_message = this->get_control_message();
|
||||||
this->control_messages_queue_.push(control_message);
|
this->control_messages_queue_.push(control_message);
|
||||||
} break;
|
} break;
|
||||||
case HonControlMethod::SET_SINGLE_PARAMETER:
|
case HonControlMethod::SET_SINGLE_PARAMETER:
|
||||||
|
@ -459,7 +459,7 @@ void HonClimate::process_phase(std::chrono::steady_clock::time_point now) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
haier_protocol::HaierMessage HonClimate::get_power_message_(bool state) {
|
haier_protocol::HaierMessage HonClimate::get_power_message(bool state) {
|
||||||
if (state) {
|
if (state) {
|
||||||
static haier_protocol::HaierMessage power_on_message(
|
static haier_protocol::HaierMessage power_on_message(
|
||||||
haier_protocol::FrameType::CONTROL, ((uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER) + 1,
|
haier_protocol::FrameType::CONTROL, ((uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER) + 1,
|
||||||
|
@ -486,7 +486,7 @@ void HonClimate::initialization() {
|
||||||
this->current_horizontal_swing_ = this->settings_.last_horizontal_swing;
|
this->current_horizontal_swing_ = this->settings_.last_horizontal_swing;
|
||||||
}
|
}
|
||||||
|
|
||||||
haier_protocol::HaierMessage HonClimate::get_control_message_() {
|
haier_protocol::HaierMessage HonClimate::get_control_message() {
|
||||||
uint8_t control_out_buffer[haier_protocol::MAX_FRAME_SIZE];
|
uint8_t control_out_buffer[haier_protocol::MAX_FRAME_SIZE];
|
||||||
memcpy(control_out_buffer, this->last_status_message_.get(), this->real_control_packet_size_);
|
memcpy(control_out_buffer, this->last_status_message_.get(), this->real_control_packet_size_);
|
||||||
hon_protocol::HaierPacketControl *out_data = (hon_protocol::HaierPacketControl *) control_out_buffer;
|
hon_protocol::HaierPacketControl *out_data = (hon_protocol::HaierPacketControl *) control_out_buffer;
|
||||||
|
|
|
@ -114,8 +114,8 @@ class HonClimate : public HaierClimateBase {
|
||||||
protected:
|
protected:
|
||||||
void set_handlers() override;
|
void set_handlers() override;
|
||||||
void process_phase(std::chrono::steady_clock::time_point now) override;
|
void process_phase(std::chrono::steady_clock::time_point now) override;
|
||||||
haier_protocol::HaierMessage get_control_message_() override;
|
haier_protocol::HaierMessage get_control_message() override;
|
||||||
haier_protocol::HaierMessage get_power_message_(bool state) override;
|
haier_protocol::HaierMessage get_power_message(bool state) override;
|
||||||
void initialization() override;
|
void initialization() override;
|
||||||
bool prepare_pending_action() override;
|
bool prepare_pending_action() override;
|
||||||
void process_protocol_reset() override;
|
void process_protocol_reset() override;
|
||||||
|
|
|
@ -180,7 +180,7 @@ void Smartair2Climate::process_phase(std::chrono::steady_clock::time_point now)
|
||||||
case ProtocolPhases::SENDING_CONTROL:
|
case ProtocolPhases::SENDING_CONTROL:
|
||||||
if (this->can_send_message() && this->is_control_message_interval_exceeded_(now)) {
|
if (this->can_send_message() && this->is_control_message_interval_exceeded_(now)) {
|
||||||
ESP_LOGI(TAG, "Sending control packet");
|
ESP_LOGI(TAG, "Sending control packet");
|
||||||
this->send_message_(get_control_message_(), this->use_crc_, CONTROL_MESSAGE_RETRIES,
|
this->send_message_(get_control_message(), this->use_crc_, CONTROL_MESSAGE_RETRIES,
|
||||||
CONTROL_MESSAGE_RETRIES_INTERVAL);
|
CONTROL_MESSAGE_RETRIES_INTERVAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -220,7 +220,7 @@ void Smartair2Climate::process_phase(std::chrono::steady_clock::time_point now)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
haier_protocol::HaierMessage Smartair2Climate::get_power_message_(bool state) {
|
haier_protocol::HaierMessage Smartair2Climate::get_power_message(bool state) {
|
||||||
if (state) {
|
if (state) {
|
||||||
static haier_protocol::HaierMessage power_on_message(haier_protocol::FrameType::CONTROL, 0x4D02);
|
static haier_protocol::HaierMessage power_on_message(haier_protocol::FrameType::CONTROL, 0x4D02);
|
||||||
return power_on_message;
|
return power_on_message;
|
||||||
|
@ -230,7 +230,7 @@ haier_protocol::HaierMessage Smartair2Climate::get_power_message_(bool state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
haier_protocol::HaierMessage Smartair2Climate::get_control_message_() {
|
haier_protocol::HaierMessage Smartair2Climate::get_control_message() {
|
||||||
uint8_t control_out_buffer[sizeof(smartair2_protocol::HaierPacketControl)];
|
uint8_t control_out_buffer[sizeof(smartair2_protocol::HaierPacketControl)];
|
||||||
memcpy(control_out_buffer, this->last_status_message_.get(), sizeof(smartair2_protocol::HaierPacketControl));
|
memcpy(control_out_buffer, this->last_status_message_.get(), sizeof(smartair2_protocol::HaierPacketControl));
|
||||||
smartair2_protocol::HaierPacketControl *out_data = (smartair2_protocol::HaierPacketControl *) control_out_buffer;
|
smartair2_protocol::HaierPacketControl *out_data = (smartair2_protocol::HaierPacketControl *) control_out_buffer;
|
||||||
|
|
|
@ -18,8 +18,8 @@ class Smartair2Climate : public HaierClimateBase {
|
||||||
protected:
|
protected:
|
||||||
void set_handlers() override;
|
void set_handlers() override;
|
||||||
void process_phase(std::chrono::steady_clock::time_point now) override;
|
void process_phase(std::chrono::steady_clock::time_point now) override;
|
||||||
haier_protocol::HaierMessage get_power_message_(bool state) override;
|
haier_protocol::HaierMessage get_power_message(bool state) override;
|
||||||
haier_protocol::HaierMessage get_control_message_() override;
|
haier_protocol::HaierMessage get_control_message() override;
|
||||||
// Answer handlers
|
// Answer handlers
|
||||||
haier_protocol::HandlerError status_handler_(haier_protocol::FrameType request_type,
|
haier_protocol::HandlerError status_handler_(haier_protocol::FrameType request_type,
|
||||||
haier_protocol::FrameType message_type, const uint8_t *data,
|
haier_protocol::FrameType message_type, const uint8_t *data,
|
||||||
|
|
Loading…
Reference in a new issue