diff --git a/esphome/components/dsmr/dsmr.cpp b/esphome/components/dsmr/dsmr.cpp index be43384330..88cfff2e4b 100644 --- a/esphome/components/dsmr/dsmr.cpp +++ b/esphome/components/dsmr/dsmr.cpp @@ -122,7 +122,9 @@ void Dsmr::drain_rx_buffer_() { uint8_t buf[64]; int avail; while ((avail = this->available()) > 0) { - this->read_array(buf, std::min(static_cast(avail), sizeof(buf))); + if (!this->read_array(buf, std::min(static_cast(avail), sizeof(buf)))) { + break; + } } }