Community
OpenEnergyMonitor

Community

APIs & parsing JSON etc

For several months I have been scraping my Powerwall SoC data via an API within Node-RED, and then graphing the output within emonCMS. Works brilliantly.

I would like to do something similar with some Solcast solar data - both Actual and later, Forecast. I have two “personal” APIs - one for each feed. I have copy / pasted the entire Powerwall Node-RED flow, substituting a local IP based API for an external url. The flow throws up an API Failed RC=200 error in the emonCMS node. In the debug window it says …

Node: solcast
msg: string[16]
“JSON parse error”

I have made no changes to this node, so presumably it is the previous node that is causing the issue. Sorry to be dim (once again), but how might I resolve this?

TIA

In case it helps, herewith a snippet from what the API returns in a browser.

{“estimated_actuals”:[
{“pv_estimate”:0.9932,“period_end”:“2020-07-15T15:30:00.0000000Z”,“period”:“PT30M”},
{“pv_estimate”:1.2944,“period_end”:“2020-07-15T15:00:00.0000000Z”,“period”:“PT30M”},
{“pv_estimate”:0.9747,“period_end”:“2020-07-15T14:30:00.0000000Z”,“period”:“PT30M”},
snip

How might I parse this, or does the software do it automatically? (Presumably not!).

This is probably a better starting point.

@haffle, I had a few problems with getting the Solcast data into emonCMS and ended up doing it via a small python script. But if I recall correctly, there were (at least) two problems. One was a misformed JSON object (a single comma or bracket…) and the other was - I think - trying to pass off an integer as a string. Does your Node-red debug node output the full JSON object in the debug window? Also there is a tick box in the json node “Format JSON string” - mine needed to be ticked.
If you can get the debug node to output the full json object that helps greatly in debugging.

1 Like