Json Data Pushed from Inverter

@Bigben83 have you seen this post? Perhaps instead of the push service you could request data from its cgi endpoints?

Just a thought.

Yes, I had seen this, but it doesn't push the data that I'm after, it only sends power generation and consumption data.

1 Like

OK, well in that case look at this...

https://repl.it/join/ozrhutci-stephenmclaughl

The code shows you how to take the first key out of an object.

So in your case, you could add a function node AFTER the HTTP IN node and add the following...

Option 1 - get the key & pass it out to a JSON node

var k = Object.keys(msg.payload)[0];//get first key in the payload object
msg.payload = k; 
return msg;

or

Option 2 - turn k into an object then pass it out (no JSON node needed)

var k = Object.keys(msg.payload)[0];//get first key in the payload object
msg.payload = JSON.parse(k)
return msg;

Give it a go. Put debug nodes before & after (to see if its working)

EDIT.
Could you also paste the data you get from the inverter into your reply?
image
... i can then check it is valid JSON

1 Like

ok this is what I got when I did the above. so that's briliant.

@Steve-Mcl Thanks heaps for your help. got the result that i needed.

2 Likes

Nice to see you got it working. A tip for the future to make things easier for yourself (and others reading along): if you give your debug nodes a name, the name is shown up in the debug sidebar as well, so rather than "node: efe050dc.1e1e5" it will show "node: my debug node" instead

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.