Compare commits

...
Author SHA1 Message Date
J. Nick Koston f3676e27d4 Merge remote-tracking branch 'origin/parse-float-prefix' into HEAD 2026-11-14 08:39:53 -06:00
J. Nick Koston 15291f06a5 Merge commit '090156a32e851ea237bf16e18e967fdbab20cdfe' into parse-float-components 2026-11-13 23:45:59 -06:00
J. Nick Koston db07dac851 Merge commit '543151ab1cffd9ddce66ab310d647ba907247abf' into parse-float-components 2026-11-13 23:05:30 -06:00
J. Nick Koston 3f8705ecbb Merge commit '3b053f1a0c5abe194d1930a0c02a8c52ac2e29b1' into parse-float-components 2026-11-13 23:05:18 -06:00
J. Nick Koston d719b9220e Merge commit '7bed89eafc5b7bbe70131a7793a92030187d656d' into parse-float-components 2026-11-13 22:37:58 -06:00
J. Nick Koston 381d6fe7cd Merge commit '04fe5cdac96bec4161ff85b29f9a7eb4eb30f64b' into parse-float-components 2026-11-13 22:13:14 -06:00
J. Nick Koston 72555af9b6 Merge commit 'b35a450f5f9ea4bb90da86da842b5583d3f6e6a3' into parse-float-components 2026-11-13 19:43:09 -06:00
J. Nick Koston 16205445bb Merge commit 'bf6d3ca470e598bffbb1573caf1118125b48b2d7' into parse-float-components 2026-11-13 19:40:00 -06:00
J. Nick Koston 6cd7dd98f3 Merge commit '16f660b0090391b511dd06ad5c20ba9e02cefcc0' into parse-float-components 2026-11-13 19:37:24 -06:00
J. Nick Koston ce3a282a41 Merge commit '1e127efe8e6c5f7e613c6661ba2d08ca6f1164c3' into parse-float-components 2026-11-13 19:35:10 -06:00
J. Nick Koston e657d18e45 Merge commit 'cdd994455141a13f0ecb7d752f98b49072b658a3' into parse-float-components 2026-11-13 19:34:32 -06:00
J. Nick Koston dacf19954f Merge commit '9e64b21eb46a2ecae9cebb3a6efacb1e42ae08c3' into parse-float-components 2026-11-13 19:21:23 -06:00
J. Nick Koston ba424d1f26 Merge commit '6f7b62602e6' into parse-float-components 2026-11-13 17:46:10 -06:00
J. Nick Koston 29020748e2 [dfrobot_sen0609][hydreon_rgxx][smt100] Use str_to_float 2026-11-13 17:00:01 -06:00
J. Nick Koston 8917409887 Merge commit 'dd08b19bd51' into parse-float-components 2026-11-13 16:59:51 -06:00
J. Nick Koston 7b8afeb4df [dfrobot_sen0609][hydreon_rgxx][smt100] Sort the parse_float.h include 2026-11-13 16:24:26 -06:00
J. Nick Koston 2eb25bf800 Merge branch 'parse-float-prefix' into parse-float-components 2026-11-13 16:24:14 -06:00
J. Nick Koston 491674adec [dfrobot_sen0609][hydreon_rgxx][smt100] Include parse_float.h for parse_float_prefix 2026-11-13 15:54:42 -06:00
J. Nick Koston e3a9f11525 Merge branch 'parse-float-prefix' into parse-float-components 2026-11-13 15:54:30 -06:00
J. Nick Koston ba53757f7e [dfrobot_sen0609] Update a comment that still named strtof 2026-11-13 15:24:03 -06:00
J. Nick Koston df31b05804 Merge branch 'parse-float-prefix' into parse-float-components 2026-11-13 15:23:56 -06:00
J. Nick Koston 774cb9e9e5 Merge remote-tracking branch 'origin/parse-float-prefix' into parse-float-components 2026-11-13 14:51:40 -06:00
J. Nick Koston c197a824e3 [dfrobot_sen0609][hydreon_rgxx][smt100] Parse floats with parse_float_prefix 2026-11-13 14:34:25 -06:00
3 changed files with 10 additions and 7 deletions

No files matched your search

@@ -3,6 +3,7 @@
#include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "esphome/core/parse_float.h"
#include "esphome/core/progmem.h"
#include <cmath>
@@ -327,8 +328,8 @@ void DFRobotSEN0609Component::parse_response_(const char *args) {
this->response_count_ = 0;
while (this->response_count_ < MAX_RESPONSE_VALUES) {
char *end;
const float value = strtof(args, &end);
// strtof also takes "nan" and "inf", which no setting can hold
const float value = str_to_float(args, &end);
// str_to_float also takes "nan" and "inf", which no setting can hold
if (end == args || !std::isfinite(value))
break;
this->response_[this->response_count_++] = value;
@@ -1,5 +1,6 @@
#include "hydreon_rgxx.h"
#include "esphome/core/log.h"
#include "esphome/core/parse_float.h"
#include <cstring>
namespace esphome::hydreon_rgxx {
@@ -235,7 +236,7 @@ void HydreonRGxxComponent::process_line_(StringRef line) {
}
// parse value, starting at str position n
float data = strtof(line.c_str() + n, nullptr);
float data = str_to_float(line.c_str() + n, nullptr);
this->sensors_[i]->publish_state(data);
ESP_LOGD(TAG, "Received %s: %f", PROTOCOL_NAMES[i], this->sensors_[i]->get_raw_state());
this->sensors_received_ |= (1 << i);
+5 -4
View File
@@ -1,5 +1,6 @@
#include "smt100.h"
#include "esphome/core/log.h"
#include "esphome/core/parse_float.h"
namespace esphome::smt100 {
@@ -24,19 +25,19 @@ void SMT100Component::loop() {
token = strtok(nullptr, ",");
if (!token)
return;
float permittivity = (float) strtod(token, nullptr);
float permittivity = str_to_float(token, nullptr);
token = strtok(nullptr, ",");
if (!token)
return;
float moisture = (float) strtod(token, nullptr);
float moisture = str_to_float(token, nullptr);
token = strtok(nullptr, ",");
if (!token)
return;
float temperature = (float) strtod(token, nullptr);
float temperature = str_to_float(token, nullptr);
token = strtok(nullptr, ",");
if (!token)
return;
float voltage = (float) strtod(token, nullptr);
float voltage = str_to_float(token, nullptr);
PUBLISH_STATE(this->counts_sensor_, counts);