Avoid too many warnings if checksum of response message is invalid

This commit is contained in:
ElVit 2026-03-19 10:22:42 +01:00
parent 1e1ebbf711
commit e242962c05
2 changed files with 6 additions and 1 deletions

View File

@ -43,6 +43,10 @@ void PanasonicHeatpumpComponent::loop() {
this->current_response_ = this->check_response(this->response_message_);
switch (this->current_response_) {
case ResponseType::UNKNOWN:
this->response_message_.clear();
this->loop_state_ = LoopState::SEND_REQUEST;
break;
case ResponseType::RECEIVING:
this->loop_state_ = LoopState::SEND_REQUEST;
break;
case ResponseType::STANDARD:
@ -285,7 +289,7 @@ ResponseType PanasonicHeatpumpComponent::check_response(const std::vector<uint8_
if (data[0] != 0x71)
return ResponseType::UNKNOWN;
if (this->response_receiving_)
return ResponseType::UNKNOWN;
return ResponseType::RECEIVING;
if (data.size() != RESPONSE_MSG_SIZE) {
ESP_LOGW(TAG, "Invalid response message length: recieved %d - expected %d", data.size(), RESPONSE_MSG_SIZE);
delay(10); // NOLINT

View File

@ -44,6 +44,7 @@ enum RequestType : uint8_t {
enum ResponseType : uint8_t {
UNKNOWN,
RECEIVING,
STANDARD,
EXTRA,
};