mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
mhz19: ignore data from sensor while it's booting
Reported CO2 might be not correct while sensor is booting and while it boots it reports value 15000 in response at offset 6-7. So skip reporting till this value is being reurned. Signed-off-by: Igor Mammedov <imammedo@redhat.com>
This commit is contained in:
parent
a78a98bef5
commit
3545803c87
@ -39,6 +39,13 @@ void MHZ19Component::update() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sensor reports U(15000) during boot, ingnore reported CO2 until it boots */
|
||||||
|
uint16_t u = (response[6] << 8) + response[7];
|
||||||
|
if (u == 15000) {
|
||||||
|
ESP_LOGD(TAG, "Sensor is booting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
const uint16_t ppm = (uint16_t(response[2]) << 8) | response[3];
|
const uint16_t ppm = (uint16_t(response[2]) << 8) | response[3];
|
||||||
const int temp = int(response[4]) - 40;
|
const int temp = int(response[4]) - 40;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user