Change payload topic

Embarrassing enough I have no idea how to change a topic on a message. I have tried the change node without luck.

So, I get the following message, and want to change the topic to "value".

 : msg.payload : number
1006

Would be nice if anyone could point me in the right direction!

image

Or...

image

Or - add a function node and put this code in...

msg.topic = "a new string";
return msg;

Or you could do something like.

msg.topic = msg.payload;
return msg;

I recommend watching this playlist: Node-RED Essentials. It is by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in less than an hour. A small investment for a lot of gain.

1 Like

Thanks!

Im trying to use the value. In the documentation it says this:

amount(optional) number
If provided, the output will contain this amount in 

And this is the result after your suggested change:

value : msg.payload : number
996.19

Still not working.

I have no idea what node you are talking about and without showing your flow it's hard to assist.

Your title said "change payload topic" the info I provided does that.

What is it exactly you need?

Show screen shots of you flow and the debug output of before and after what you want to change.

Ps. Watch those videos. They will help you solve this yourself.

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