# How to change Topic with MQTT Out node?

**URL:** https://discourse.nodered.org/t/how-to-change-topic-with-mqtt-out-node/87316
**Category:** General
**Created:** [18 April 2024 15:14 UTC](https://discourse.nodered.org/t/how-to-change-topic-with-mqtt-out-node/87316 "2024-04-18T15:14:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![el\_pablo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/el_pablo/32/45496_2.png) [@el\_pablo](https://discourse.nodered.org/u/el_pablo)
#### Post date: [18 April 2024 15:14 UTC](https://discourse.nodered.org/t/how-to-change-topic-with-mqtt-out-node/87316/1 "2024-04-18T15:14:54Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e784d73f26c20c9273a86eb9964e4c29070728b9.png)

![firefox_anYfUkOVfF](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/494a0165324d0e7e596025534323378285c4a4da.png)

Motor switch node

![firefox_Pf1YBxT6PO](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/2/823214849603b9b5a3f0919f8a911f1036032297.png)

Color picker node  
 ![firefox_56582c2R8Y](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/b/6b450d39abe46d5392f40c7f7f5f213875d38637.png)

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?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [18 April 2024 15:32 UTC](https://discourse.nodered.org/t/how-to-change-topic-with-mqtt-out-node/87316/2 "2024-04-18T15:32:44Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![el\_pablo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/el_pablo/32/45496_2.png) [@el\_pablo](https://discourse.nodered.org/u/el_pablo)
#### Post date: [18 April 2024 15:38 UTC](https://discourse.nodered.org/t/how-to-change-topic-with-mqtt-out-node/87316/3 "2024-04-18T15:38:47Z")

</div>

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. 😂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [2 May 2024 15:39 UTC](https://discourse.nodered.org/t/how-to-change-topic-with-mqtt-out-node/87316/4 "2024-05-02T15:39:14Z")

</div>

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