diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 769a7825da..c65ca919ba 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -257,7 +257,7 @@ std::string to_string(long double val) { optional parse_float(const std::string &str) { char *end; float value = ::strtof(str.c_str(), &end); - if (end == nullptr) + if (end == nullptr || end != str.end().base()) return {}; return value; }