mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 15:08:10 +01:00
Fix for encrypted DSMR regression (#2679)
Co-authored-by: Maurice Makaay <account-github@makaay.nl>
This commit is contained in:
parent
96a50f5c6b
commit
be9439f10d
1 changed files with 8 additions and 7 deletions
|
@ -76,9 +76,10 @@ void Dsmr::receive_telegram_() {
|
|||
}
|
||||
// Check for the end of the hex checksum, i.e. a newline.
|
||||
if (footer_found_ && c == '\n') {
|
||||
header_found_ = false;
|
||||
// Parse the telegram and publish sensor values.
|
||||
parse_telegram();
|
||||
|
||||
header_found_ = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -105,12 +106,12 @@ void Dsmr::receive_encrypted_() {
|
|||
|
||||
// Find a new telegram start byte.
|
||||
if (!header_found_) {
|
||||
if ((uint8_t) c == 0xDB) {
|
||||
if ((uint8_t) c != 0xDB) {
|
||||
continue;
|
||||
}
|
||||
ESP_LOGV(TAG, "Start byte 0xDB of encrypted telegram found");
|
||||
header_found_ = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for buffer overflow.
|
||||
if (buffer_length >= MAX_TELEGRAM_LENGTH) {
|
||||
|
@ -147,10 +148,10 @@ void Dsmr::receive_encrypted_() {
|
|||
ESP_LOGV(TAG, "Decrypted telegram size: %d bytes", telegram_len_);
|
||||
ESP_LOGVV(TAG, "Decrypted telegram: %s", this->telegram_);
|
||||
|
||||
parse_telegram();
|
||||
|
||||
header_found_ = false;
|
||||
telegram_len_ = 0;
|
||||
|
||||
parse_telegram();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue