Ignore NaN states in the integration component (#3767)

This commit is contained in:
anatoly-savchenkov 2022-09-04 10:21:17 +03:00 committed by GitHub
parent 4788a6182e
commit 7a4cf13e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,8 @@ void IntegrationSensor::setup() {
}
void IntegrationSensor::dump_config() { LOG_SENSOR("", "Integration Sensor", this); }
void IntegrationSensor::process_sensor_value_(float value) {
if (std::isnan(value))
return;
const uint32_t now = millis();
const double old_value = this->last_value_;
const double new_value = value;