Dynamic label in gauge node

Hello I am trying to set dynamically the label of some gauges by injecting a string (i.e. "mylabel") in a, msg.topic using a change node. It is not working. Can someone provide a simple example with an inject node + change node + gauge node and modifying the label in gauge node?

note a succeed to change value, and gauge ranges too but not the label.

thanks a million.

What have you got Label set to in the Gauge nodes properties?

[{"id":"1c2d8063.ffd98","type":"ui_gauge","z":"66c7738a.9aedd4","name":"","group":"60dbb005.0de84","order":0,"width":0,"height":0,"gtype":"gage","title":"{{topic}}","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":556,"y":233,"wires":[]},{"id":"f2ad57c4.ab6818","type":"inject","z":"66c7738a.9aedd4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":143,"y":118,"wires":[["caa0fea4.2d07e"]]},{"id":"caa0fea4.2d07e","type":"change","z":"66c7738a.9aedd4","name":"10 nm","rules":[{"t":"set","p":"payload","pt":"msg","to":"10","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":326,"y":136,"wires":[["1c2d8063.ffd98"]]},{"id":"3183b7fe.17aea","type":"change","z":"66c7738a.9aedd4","name":"label1","rules":[{"t":"set","p":"topic","pt":"msg","to":"label1","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":318,"y":228,"wires":[["1c2d8063.ffd98"]]},{"id":"8c00a1bc.87b528","type":"change","z":"66c7738a.9aedd4","name":"Label2","rules":[{"t":"set","p":"topic","pt":"msg","to":"Label2","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":321,"y":324,"wires":[["1c2d8063.ffd98"]]},{"id":"16d2b4a6.7d73b3","type":"inject","z":"66c7738a.9aedd4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":155,"y":228,"wires":[["3183b7fe.17aea"]]},{"id":"1b719264.6c406e","type":"inject","z":"66c7738a.9aedd4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":173,"y":336,"wires":[["8c00a1bc.87b528"]]},{"id":"60dbb005.0de84","type":"ui_group","z":"","name":"control","tab":"1d3f043a.f4b0d4","order":1,"disp":true,"width":"6","collapse":false},{"id":"1d3f043a.f4b0d4","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

Hello, thanks for the example which is perfectly working. I could get my flow working now.
thank you.

pretty sure the solution is in post 2 not post 3...:laughing:

sorry for "solution" in post 3. My mistake.

another question, how to set automatically "units" field in gauge. I tried by sending a json {"unit":"celcuis"} in topic and I set the units field in gauge to be {{unit}} (I tried {{topic.unit}} too}}
but it is not working. do you have any ideas?

As far I know, there is no any legal way to change units field on fly.

And again, I was wrong :slight_smile:

image

I added the label setting in the below image

Do I have to change some setting in below screen also as changes are not reflecting in the dashboard.

In the change node just set msg.label to "Hello" - then in the gauge set the Label field to {{msg.label}}

Many thanks for your reply. I changed the settings as per the suggestion



but still the guage not showing any label.

which version of dashboard are you running - it was a fairly recent update.

sir I am using 2.26.0

Well, it doesn't work for me also. Tried pretty hard ...

Well. It actually works but there is cases where it fails and after failure the label does not recover.
One case were it fails is when you try to get value from non existent property within angular filters.

Example ?

Again wrong. It recovers. I had wires crossed too heavily already :stuck_out_tongue:
But for sure, if value parsing fails then the label also will be missed. But who cares about the label if there is no value.
So no case.

There is another interesting case with not hard failure, just may be confusing

[{"id":"fb505a25.7b7148","type":"inject","z":"e8af3254.77f7e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.2","topic":"","payload":"35","payloadType":"num","x":310,"y":80,"wires":[["dbaef54f.dc0428"]]},{"id":"149353d0.fc1d0c","type":"ui_gauge","z":"e8af3254.77f7e","name":"value","group":"60dbb005.0de84","order":2,"width":"6","height":"4","gtype":"gage","title":"{{title}}","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":730,"y":80,"wires":[]},{"id":"9a210679.f1fa88","type":"ui_gauge","z":"e8af3254.77f7e","name":"payload.something","group":"60dbb005.0de84","order":4,"width":"6","height":"4","gtype":"gage","title":"{{title}}","label":"units","format":"{{payload.something | number:2}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":750,"y":160,"wires":[]},{"id":"79aee4e1.59f08c","type":"inject","z":"e8af3254.77f7e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":330,"y":160,"wires":[["bc76935f.f499e"]]},{"id":"bc76935f.f499e","type":"random","z":"e8af3254.77f7e","name":"","low":1,"high":10,"inte":"true","property":"payload","x":500,"y":160,"wires":[["9a210679.f1fa88","149353d0.fc1d0c"]]},{"id":"dbaef54f.dc0428","type":"change","z":"e8af3254.77f7e","name":"","rules":[{"t":"set","p":"title","pt":"msg","to":"ABC","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":80,"wires":[["149353d0.fc1d0c","9a210679.f1fa88"]]},{"id":"60dbb005.0de84","type":"ui_group","name":"control","tab":"1d3f043a.f4b0d4","order":1,"disp":true,"width":"6","collapse":false},{"id":"1d3f043a.f4b0d4","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

Oh I forgot to clarify
It works if you configure it like {{label}} not {{msg.label}}

1 Like