helgeerbe / OpenDTU-OnBattery

Software for ESP32 to talk to Hoymiles Inverters and Victrons MPPT battery chargers (Ve.Direct)
GNU General Public License v2.0
278 stars 60 forks source link

HTTP+JSON PowerMeter: Strings not accepted #1104

Closed schlimmchen closed 1 month ago

schlimmchen commented 1 month ago

Discussed in https://github.com/helgeerbe/OpenDTU-OnBattery/discussions/1049

Originally posted by **oszi-xx** June 15, 2024 I'm using a SHRDZM (ESP8266) to read my power meter data. Up to now it was working. After update to latest version I got error if I'm using same settings (newer than 2024.01.04 ) [HttpPowerMeter] not a float: '69' How can I solve the problem .
schlimmchen commented 1 month ago

The issue at hand is that the JSON looks like this:

{
"timestamp":"2024-06-16T07:52:40",
"32.7.0":"238.10",
"52.7.0":"238.70",
"72.7.0":"238.40",
"31.7.0":"0.00",
"51.7.0":"0.00",
"71.7.0":"1.36",
"1.7.0":"223",
"2.7.0":"0",
"1.8.0":"2877154",
"2.8.0":"41250",
"3.8.0":"51536",
"4.8.0":"499860",
"16.7.0":"223",
"uptime":"0000:20:07:15"
}

The values, which are indeed numeric, are encoded as strings. The source of this JSON is stupid and does not use JSON as expected, but we should be tolerant and handle this gracefully.

github-actions[bot] commented 1 week ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.