How do extract specific topic from payload.msg and display in a dial on the DASHBOARD

I have a feed as follows:-

solarmd/energy/outputEnergy/bank1 : msg.payload : Object
object
sniu: false
serialNumber: null
deviceID: null
lastUpdate: 1676979049723
voltageV: 54.425
currentA: 1.836
powerW: 99.88758
capacityP: 99.98902469135803
capacityAh: 143.98419555555554
ratedCapacityAh: 144
ratedVoltageV: 51.2
ratedChargeCurrentC: 0.6940000000000001
ratedDischargeCurrentC: 0.6940000000000001
storageName: "bank1"
remainingTimeSign: 0
dcConnected: true
available: true
dcConnectedDevice: 1

I am able to show the value of only the "msg.payload.capacityP" in the debug window.

The issue I have is I am unable to use that value in say the "gauge" on the "Dashboard"

the msg.payload

The gauge properties:

Useless gauge...
image

Where the payload only had one topic it was rather easy for me to set-up.
Multiple topics and I cannot do it.

Anyone that can help me please?

It looks like capacityP is a string. The gauge node needs a number.

Thanks for the pointer.
How do I convert it so I can test it?

I suppose I will have to put a node before the gauge display node to do the conversion.

@jw_te_r The gauge node will accept a string as long as it parses to a number

You can set the gauge value format field to {{msg.payload.capacityP | number : 2}} which will round the values to 2 decimal places also. Angularjs filter

1 Like

:man_dancing:

Thanks @E1cid

Problem SOLVED!!

image

Sorry to bother you again.

I have added a "Gauge" to indicate Battery charge / Battery discharge
To check my number I added a text node above the gauge (Will remove at a later stage)

This is what I see:
image

And this is my gauge node properties

Just got a discharge as well
image

When the battery charges I would like it to show green and to the plus side.
When the battery discharges I would like the gauge to show red on the negative side
I was considering using a BAR with positive and negative Max and Min.

The issue here is where do I enter the Value Format Code you sent earlier

Using a bar chart you would send a payload formated like these examples node-red-dashboard/Charts.md at master · node-red/node-red-dashboard · GitHub

but if you update your dashboard node to latest

you can use the gauge and fill from center
eg

[{"id":"7d193ecae230ff14","type":"inject","z":"8a39156f80306c37","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-2000","payloadType":"num","x":210,"y":200,"wires":[["3dcb6e034db30680"]]},{"id":"3dcb6e034db30680","type":"ui_gauge","z":"8a39156f80306c37","name":"","group":"2d4fe667.28f8ba","order":19,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{msg.payload}}","min":"-4000","max":"4000","colors":["#ff0000","#e6e600","#00ff00"],"seg1":"0","seg2":"0","diff":true,"className":"","x":350,"y":160,"wires":[]},{"id":"15412fd83aa65564","type":"inject","z":"8a39156f80306c37","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":210,"y":240,"wires":[["3dcb6e034db30680"]]},{"id":"0257d87b2f3e8e81","type":"inject","z":"8a39156f80306c37","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2000","payloadType":"num","x":210,"y":280,"wires":[["3dcb6e034db30680"]]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]


Thank you so much for your QUICK responses and expert assistance.
I really appreciate it very much.

I now have a gauge that shows me in which direction the electricity flows!!!!
AWESOME Thank you!

:man_dancing:

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