mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
allow negative ppm for sensair (#6385)
This commit is contained in:
parent
4de58559c6
commit
d121fa5d05
1 changed files with 2 additions and 2 deletions
|
@ -54,9 +54,9 @@ void SenseAirComponent::update() {
|
|||
this->status_clear_warning();
|
||||
const uint8_t length = response[2];
|
||||
const uint16_t status = (uint16_t(response[3]) << 8) | response[4];
|
||||
const uint16_t ppm = (uint16_t(response[length + 1]) << 8) | response[length + 2];
|
||||
const int16_t ppm = int16_t((response[length + 1] << 8) | response[length + 2]);
|
||||
|
||||
ESP_LOGD(TAG, "SenseAir Received CO₂=%uppm Status=0x%02X", ppm, status);
|
||||
ESP_LOGD(TAG, "SenseAir Received CO₂=%dppm Status=0x%02X", ppm, status);
|
||||
if (this->co2_sensor_ != nullptr)
|
||||
this->co2_sensor_->publish_state(ppm);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue