A suggestion for the newer version of NR - when it comes out

#1

Though possibly "petty" this has caught my attention a few times lately:

The TEXT NODE:
It is always in the order: label value. Never value label.
(See attached)

(And I am sure this applies to other nodes as well....)

SOMETIMES it may be nice to have the value then the label.

Just a thought.

0 Likes

#2

If you store label as a message property (eg. msg.label) than you can use a function node to swap msg.payload and msg.label

r-01

Flow:

[{"id":"55d6a657.fff118","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"a7ade488.4b36b8","type":"inject","z":"55d6a657.fff118","name":"","topic":"","payload":"Value","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":190,"y":200,"wires":[["77ba2eae.4bc25"]]},{"id":"818bb9c5.5b8558","type":"ui_text","z":"55d6a657.fff118","group":"c22b50e5.35a44","order":0,"width":0,"height":0,"name":"","label":"{{msg.label}}","format":"{{msg.payload}}","layout":"row-left","x":750,"y":200,"wires":[]},{"id":"77ba2eae.4bc25","type":"function","z":"55d6a657.fff118","name":"Set Label","func":"msg.label = \"LABEL\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":200,"wires":[["9ebe3a9d.3ccf58"]]},{"id":"60ca5d25.c33434","type":"debug","z":"55d6a657.fff118","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":750,"y":120,"wires":[]},{"id":"9ebe3a9d.3ccf58","type":"function","z":"55d6a657.fff118","name":"Swap Label and Value","func":"let a = msg.payload;\nlet b = msg.label;\nmsg.payload = b;\nmsg.label = a;\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":200,"wires":[["818bb9c5.5b8558","60ca5d25.c33434"]]},{"id":"c22b50e5.35a44","type":"ui_group","z":"","name":"Group 1","tab":"44961e53.9365d","disp":true,"width":"8","collapse":false},{"id":"44961e53.9365d","type":"ui_tab","z":"","name":"Tab1","icon":"dashboard"}]
1 Like

#3

Ok.

But if "noobs" use the text node (as is) and don't know about that trick it could be annoying.

As it is an option in/on the node, I thought I would mention it as it has caught me a couple of times.

0 Likes