Output feed returns two values, how do I split it up into two separate strings?

This is the output of my inverter data stream
nodered

{"String_watts":[654,1595],"Todays_Yeild":3.801,"Voltage":244.66,"grid_feedin":0,"grid_consumption":0,"power":2154,"available_sessions":1}

The [654,1595] is the problem as it contains two values that are stopping me from feeding it into MQTT.
What's the best way to go about getting this into the correct format?

Thanks

What is the correct format? You'll need to provide info for us to help you.

That said, some basic node-red info might help you to figure this out.

Canned text . .

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

https://nodered.org/docs/user-guide/messages


I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Thanks for the speedy response.

I have taken a look at the guides you've suggested, but I still need a hint as to how best to manipulate this data.

The of the data is my solar inverter. This is being brought into NodeRed with the SMA-Webconnect addon.
I can configure the data it sources from the inverter through altering the .js file for the plugin, but the watts values for the two MPPT strings come as a package, hence the image I attached.

I am passing the data on to EmonCMS via MQTT and what I want is for the data (string A & B watts) to be broken up into separate objects so that EmonCMS can read them.

Which would be the best function in NodeRed to accomplish this?

Edit: For clarity. Right now I have data flowing directly from the plugin to a MQTT Out node

Here are some specific examples of accessing the array elements in your object, and moving/setting them to other properties. Hope it nudges your gray matter.

[{"id":"8034f1d4.e672","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"String_watts\":[654,1595],\"Todays_Yeild\":3.801,\"Voltage\":244.66,\"grid_feedin\":0,\"grid_consumption\":0,\"power\":2154,\"available_sessions\":1}","payloadType":"json","x":130,"y":1340,"wires":[["795d8672.ce1a","dc94610d.07b708","539c5327.bfaebc","175b8b89.9b7c24"]]},{"id":"795d8672.ce1a","type":"debug","z":"c791cbc0.84f648","name":"first element of array","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.String_watts[0]","statusType":"msg","x":580,"y":1320,"wires":[]},{"id":"dc94610d.07b708","type":"debug","z":"c791cbc0.84f648","name":"second element of array","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.String_watts[1]","statusType":"msg","x":570,"y":1380,"wires":[]},{"id":"539c5327.bfaebc","type":"change","z":"c791cbc0.84f648","name":"move array element to payload","rules":[{"t":"move","p":"payload.String_watts[1]","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":1460,"wires":[["eadb43e6.8ef57"]]},{"id":"175b8b89.9b7c24","type":"change","z":"c791cbc0.84f648","name":"set array element to payload.s","rules":[{"t":"move","p":"payload.String_watts[0]","pt":"msg","to":"payload.first_watts","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":1520,"wires":[["779401e2.363e68"]]},{"id":"eadb43e6.8ef57","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":590,"y":1460,"wires":[]},{"id":"779401e2.363e68","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.first_watts","statusType":"msg","x":600,"y":1520,"wires":[]}]

Can You give as an example on how You want the separate object to look like.
Is it just the number like {658} or is it an object like {value : 658} etc?

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