I need help with a output

how can i change the output to #hex

Hi @ItsLarsBB

You could use a Function node configured with:

msg.payload = "#"+msg.payload;
return msg; 

The Function allows you to write JavaScript that is run against each message it receives.


If you’re going to spend much time with Node-RED, it’s worth familiarising yourself with some of the basics of JavaScript

Other options include…

You could use a Template node (normal template, not dashboard template) configured with:


You could use a Change node to set msg.payload to the expression '#' & $.payload

1 Like

Hi @knolleary

Thx :+1:

The change node can also use a regex to modify the string -- like so:


(the regex character ^ matches the beginning of the line)