Dynamically changing debug node's name

This was discussed here https://discourse.nodered.org/t/auto-name-debug-node-with-some-serialization-with-an-option-to-override-the-name/53926

I know debug nodes are now given a name "Debug n" but was the ability to change the name dynamically ever implemented?

Sometimes it is desirable to display two properties of a message in the debug pane, this would allow economy of debug pane space - from this
Untitled 1
to this (using msg.payload.device as the debug node's name)
Untitled 3

No. Node names are not dynamic.

We already display the value of msg.topic in the top left of the message which would appear to satisfy your requirement to be able to show two message properties within the confines of what's already there.

Thanks @knolleary.
msg.topic doesn't achieve the same thing in this case because these are elements of a single message from mqtt - so they share a msg.topic. Edit - nonsense!

I can use a switch on msg.payload.device with multiple hard-coded and appropriately named debug nodes "Paint mixer", "Target colour", etc.

Or you can set msg.topic to whatever you want before it reaches the debug node.

Why not configure the debug node like this?

[{"id":"e5f991e0ac85021b","type":"inject","z":"c3b4e23e95193f6b","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"hex\":\"ff5c00\",\"device\":\"paint mixer\"}","payloadType":"json","x":250,"y":400,"wires":[["595249a4a22101a1"]]},{"id":"595249a4a22101a1","type":"debug","z":"c3b4e23e95193f6b","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"msg.payload.device & \":\" & msg.payload.hex","targetType":"jsonata","statusVal":"","statusType":"auto","x":380,"y":400,"wires":[]}]

Thanks for the suggestion.
Actually it's not for a paint mixing machine but trying to debug interaction between individual RPi / ESP connected neopixels (Christmas is coming!).
If msg.payload is a hex colour code, the debug output includes a colour swatch, as you see in the original post.
If payload concatenates the device name and hex code, the swatch is lost, so no good for this application.

@knolleary's suggestion of changing msg.topic is (of course) the best dynamic solution

Debug node is for debugging, you should consider a dashboard/dedicated web interface instead ?

Yes. Got one of them. A bit of a clue in the name I suppose. This is for debugging.

I completely missed that. How do you get that to happen? It doesn't seem to work for me.

It only works if msg.payload is a string "#xxxxxx". An inject node #ff00ff works for me, but in some circumstances eg output from exec node I have to pass it through a function to lose a trailing carriage return.

msg.payload = msg.payload.trim();

Nice. I didn't know it could do that. I left out the #, thinking it wouldn't matter. :slightly_smiling_face:

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