Browse Source

sns: fix slash removal in modules (#2552)

fix invalid prometheus syntax `strconv.ParseFloat: parsing "/0": invalid syntax`
fix another instance of remove('/')
pull/2558/head
ktkd 1 year ago
committed by GitHub
parent
commit
1169be25a5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      code/espurna/prometheus.cpp
  2. +1
    -1
      code/espurna/rpnrules.cpp

+ 1
- 1
code/espurna/prometheus.cpp View File

@ -57,7 +57,7 @@ void handler(AsyncWebServerRequest* request) {
for (size_t index = 0; index < magnitudeCount(); ++index) {
auto value = magnitudeValue(index);
if (value) {
value.topic.remove('/');
value.topic.replace("/", "");
response->printf_P(PSTR("%s %s\n"),
value.topic.c_str(), value.repr.c_str());
}


+ 1
- 1
code/espurna/rpnrules.cpp View File

@ -1104,7 +1104,7 @@ void updateVariables(const espurna::sensor::Value& value) {
static_assert(std::is_same<decltype(value.value), rpn_float>::value, "");
auto topic = value.topic;
topic.remove('/');
topic.replace("/", "");
rpn_variable_set(internal::context,
topic, rpn_value(static_cast<rpn_float>(value.value)));


Loading…
Cancel
Save