Hi guys.
I’ve setup a small Node-RED flow to display values from the MPPT1210HUS; it can be easily adopted to other devices. It took me a moment to figure it out, so I thought I’m gonna share.
Here is the flow with all the values of the MPPT on the right:
The code of the first function node 'delete #mSerial ’ looks like this:
msg.payload = msg.payload.replace("#mSerial ", "");
return msg;
It is needed to be able put the output into a JSON parser. The JSON node has to be set to:
Convert between JSON String & Object
The function node ‘router’ directs the different payloads towards individual outputs:
tag1 = {payload: msg.payload.Device.rUptime_s}
tag2 = {payload: msg.payload.Device.rErrorFlags}
tag3 = {payload: msg.payload.Load.rMeas_A}
tag4 = {payload: msg.payload.Battery.rMeas_V}
tag5 = {payload: msg.payload.Solar.rMeas_V}
tag6 = {payload: msg.payload.Load.pOutDay_Wh}
return [msg,tag1,tag2,tag3,tag4,tag5,tag6];
Here is where you can add your own code. Make sure to adjust the number of outputs on the Setup tab. To find the path of a ThingSet parameter, follow this small guide and go to the section " Understanding the structure of a message"
https://nodered.org/docs/user-guide/messages
And this is how the GUI looks like:
Best,
Dan