From 6ff866cf5b79b58bdef84def05b777ed3086e87e Mon Sep 17 00:00:00 2001 From: Long Vo Date: Fri, 8 Nov 2024 15:57:38 +0700 Subject: [PATCH] Fix nan issue for engineering mode --- esphome/components/ld2410/ld2410.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/ld2410/ld2410.cpp b/esphome/components/ld2410/ld2410.cpp index c3b57815d6..9a7fc9ade7 100644 --- a/esphome/components/ld2410/ld2410.cpp +++ b/esphome/components/ld2410/ld2410.cpp @@ -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