Fix nan issue for engineering mode

This commit is contained in:
Long Vo 2024-11-08 15:57:38 +07:00
parent 2f77d31690
commit 6ff866cf5b

View file

@ -255,16 +255,16 @@ void LD2410Component::handle_periodic_data_(uint8_t *buffer, int len) {
} else {
for (auto *s : this->gate_move_sensors_) {
if (s != nullptr && !std::isnan(s->get_state())) {
s->publish_state(NAN);
s->publish_state(0);
}
}
for (auto *s : this->gate_still_sensors_) {
if (s != nullptr && !std::isnan(s->get_state())) {
s->publish_state(NAN);
s->publish_state(0);
}
}
if (this->light_sensor_ != nullptr && !std::isnan(this->light_sensor_->get_state())) {
this->light_sensor_->publish_state(NAN);
this->light_sensor_->publish_state(0);
}
}
#endif