# \[solved\] How to send MQTT topic w/o payload

**URL:** <https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731>\
**Category:** General\
**Created:** [1 May 2019 23:31 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731 "2019-05-01T23:31:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![onkel\_joerg](https://avatars.discourse-cdn.com/v4/letter/o/d9b06d/32.png) [@onkel\_joerg](https://discourse.nodered.org/u/onkel_joerg)\
**Post date:** [1 May 2019 23:31 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731/1 "2019-05-01T23:31:45Z")

</div>

Hello all,  
I am searching for a solution to send only the topic without the payload.  
Background: I have a Heos 1 Wifi speaker. it is connected to my homeautomation system FHEM. FHEM is able to publish ans subscibe MQTT messages.  
This speaker starts to play on `/cmnd/entertain/wz/heos1/play` and stops on `/cmnd/entertain/wz/heos1/stop`  
Both commands sendet by hand on the MQTT broker UI do very well.  
How do i tell node red to send only the topic without any payload.

Best regards O.J.  
(please excuse my weak english)

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [2 May 2019 00:17 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731/2 "2019-05-02T00:17:00Z")

</div>

It is easy to remove the payload property from the msg object. A change node configured to delete the payload property would do the trick, but..

Doing a quick testing shows that the mqqt out node will send an empty string whenever `msg.payload` equals `null` or `undefined`

Therefore the question to be asked is : is it a problem for you to send an empty string as the payload ?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 May 2019 04:44 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731/3 "2019-05-02T04:44:32Z")

</div>

Yes just set msg.payload = “”; ie empty string and mqtt will do the right thing

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 May 2019 05:45 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731/4 "2019-05-02T05:45:29Z")

</div>

Does it work if you send play or stop messages on the topic /cmnd/entertain/wz/heos ?

---

<div class="post-metadata">

**Author:** ![onkel\_joerg](https://avatars.discourse-cdn.com/v4/letter/o/d9b06d/32.png) [@onkel\_joerg](https://discourse.nodered.org/u/onkel_joerg)\
**Post date:** [2 May 2019 17:05 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731/5 "2019-05-02T17:05:01Z")

</div>

> [@dceejay](#):
>
> msg.payload = “”;

sorry, Im an absolute noob. how do i convert the msg.payload to “”

 ![Skizze%20node()](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1f9d8992d013586656d7e73e2df8fc1fbd3d81bf.png) ![Skizze%20node()](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1f9d8992d013586656d7e73e2df8fc1fbd3d81bf.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 May 2019 17:10 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731/6 "2019-05-02T17:10:07Z")

</div>

This forum has changed the normal double-quotes into smart quotes, making it in invalid.

Try this:

```auto
msg.payload="";
return msg;

```

You could also use a Change node to set msg.payload to an empty string.

---

<div class="post-metadata">

**Author:** ![onkel\_joerg](https://avatars.discourse-cdn.com/v4/letter/o/d9b06d/32.png) [@onkel\_joerg](https://discourse.nodered.org/u/onkel_joerg)\
**Post date:** [2 May 2019 17:17 UTC](https://discourse.nodered.org/t/solved-how-to-send-mqtt-topic-w-o-payload/10731/7 "2019-05-02T17:17:08Z")

</div>

found a better way:  
I changed the payload type to "buffer" then in to the 3 points to change the content, but didnt change anything.  
Injecting this gives an empty buffer (msg.payload : buffer[0])

Thank you all for your help
