How to change Topic with MQTT Out node?

Hi,

This is a stupid simple question, but I don't know how to change dynamically the topic of an MQTT Out node.

I've read that I need to leave it blank and it will take the topic from the input msg, but it doesn't work.

firefox_oCZ3zG58iZ

firefox_anYfUkOVfF

Motor switch node

firefox_Pf1YBxT6PO

Color picker node
firefox_56582c2R8Y

I'm using mqtt-explorer to debug and track messages. I see the topic and message if I fill the topic property, but nothing is happening if I leave blank.

What Am I doing wrong?

you have msg.motor and msg.colour (note the msg. part)

Did you mean to actually use a fixed topic of motor and colour? If yes, then change the msg. dropdown to a/z (string)

what you currently have is telling the node to get the value of msg.motor and msg.colour from the msg object at runtime (which i assume is not actually present)

Thanks I figured it out a few minutes after posting this message.

I'm from the embedded and native world and this NodeRed and all the web techs are new to me. I have so much to learn and makes my head hurt. :joy:

1 Like