diff --git a/esphome/components/cse7766/cse7766.cpp b/esphome/components/cse7766/cse7766.cpp index 2868af5152..ae4b9c9316 100644 --- a/esphome/components/cse7766/cse7766.cpp +++ b/esphome/components/cse7766/cse7766.cpp @@ -27,7 +27,9 @@ void CSE7766Component::loop() { uint8_t buf[CSE7766_RAW_DATA_SIZE]; while (avail > 0) { size_t to_read = std::min(static_cast(avail), sizeof(buf)); - this->read_array(buf, to_read); + if (!this->read_array(buf, to_read)) { + break; + } avail -= to_read; for (size_t i = 0; i < to_read; i++) {