diff --git a/esphome/components/mhz19/mhz19.cpp b/esphome/components/mhz19/mhz19.cpp index 4c29e80e0e..581d010aaf 100644 --- a/esphome/components/mhz19/mhz19.cpp +++ b/esphome/components/mhz19/mhz19.cpp @@ -53,12 +53,12 @@ void MHZ19Component::update() { bool MHZ19Component::mhz19_write_command_(const uint8_t *command, uint8_t *response) { this->write_array(command, MHZ19_REQUEST_LENGTH); this->write_byte(mhz19_checksum(command)); + this->flush(); if (response == nullptr) return true; bool ret = this->read_array(response, MHZ19_RESPONSE_LENGTH); - this->flush(); return ret; } float MHZ19Component::get_setup_priority() const { return setup_priority::DATA; }