Gauge Type Level - Dynamically change Unit field

HI

i am trying to set this field in function before this node. Mililiters, Liters, Hectoliters or units ml, l, hl.

Function:
msg.unit = "test";
return msg;

I have tried with:
{{unit}} {{msg.unit}} msg.unit

i have also tried with inserting in Value format field like this:
{{value}} {{unit}}
{{msg.payload}} {{msg.unit}}
...

Not sure how to get this value.

This works for me, {{msg.unit}} running on latest version dashboard 3.2.0

scratch that, i miss read , you are using level. Does not work for me.

Try this.

[{"id":"d7f7ba999a0f5032","type":"ui_gauge","z":"829f16a2994adbca","name":"abc","group":"df87679bdeb6f942","order":0,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"{{msg.topic}}","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":590,"y":940,"wires":[]},{"id":"946733c3b656b537","type":"inject","z":"829f16a2994adbca","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":940,"wires":[["b874f13ddcfc0514"]]},{"id":"b874f13ddcfc0514","type":"function","z":"829f16a2994adbca","name":"function 6","func":"let msg1= {}\n\nlet value = 86\n\nmsg1.topic = 'gallon' // Units\nmsg1.payload = value\n\nreturn msg1;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":940,"wires":[["d7f7ba999a0f5032","b19cb9342be806f5"]]},{"id":"b19cb9342be806f5","type":"debug","z":"829f16a2994adbca","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":980,"wires":[]},{"id":"df87679bdeb6f942","type":"ui_group","name":"Default","tab":"34467927046a8b09","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"34467927046a8b09","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

It's all in the gauge help page.

Hey tnx for msg but this works only if u have type gauge but not when u have type "level".

This is because of level type of gauge uses different library. It behaves differently, I cant say if it is possible to achieve different way but do explore the documents and you may find a way.

See notes from document bottom.

If the "Wave" animation is not main thing you are using the level gauge, it is easy enough to create your own level gauge.
Here's the starting point.

@dceejay @mojgithub

It "looks" like you could use - symbol : string // special symbol to show next to value
However I cannot get this to work?

The docs above show set msg.ui_control to JSON { "min":10, "max":50 } this changes the gauge straight away.

{"label":"test"} does work but only after refreshing the browser.

At the bottom of the docs it says -

The gauge options can accept any of the Justgage parameters for example:

 {"options":{"pointer":false,"gaugeWidthScale":1.5}}
 {"options":{"pointer":true,"gaugeWidthScale":0.4,"reverse":true}}

But {"options":{"symbol":"K"}} has no effect

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