I need help with a output

#1

how can i change the output to #hex

0 Likes

#2

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.

https://nodered.org/docs/writing-functions

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:

#{{payload}}

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

1 Like

#3

Hi @knolleary

Thx :+1:

0 Likes

#4

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

image

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

0 Likes