mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
allow negative ppm for sensair (#6385)
This commit is contained in:
parent
e753ac3a97
commit
23f8498ff9
1 changed files with 2 additions and 2 deletions
|
@ -54,9 +54,9 @@ void SenseAirComponent::update() {
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
const uint8_t length = response[2];
|
const uint8_t length = response[2];
|
||||||
const uint16_t status = (uint16_t(response[3]) << 8) | response[4];
|
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)
|
if (this->co2_sensor_ != nullptr)
|
||||||
this->co2_sensor_->publish_state(ppm);
|
this->co2_sensor_->publish_state(ppm);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue