# Mosquitto\_pub help, please

**URL:** <https://discourse.nodered.org/t/mosquitto-pub-help-please/24559>\
**Category:** General\
**Created:** [10 April 2020 02:08 UTC](https://discourse.nodered.org/t/mosquitto-pub-help-please/24559 "2020-04-10T02:08:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [10 April 2020 02:08 UTC](https://discourse.nodered.org/t/mosquitto-pub-help-please/24559/1 "2020-04-10T02:08:49Z")

</div>

I have an MQTT broker running on a Raspberry Pi (192.168.1.124). Been there for a couple of years.  
I am trying to send an MQTT message to that broker from another computer using:

`mosquitto_pub -h 192.168.1.124 -t cmnd/desklight/power/ -m "on" -d`

This is using the same topic and the same message as in my Node Red flow.  
The -d gives me:

```auto
Sending CONNECT
Receiving CONNACK (0)
Sending PUBLISH (d0, q0, r0, m1, 'cmnd/desklight/power', ... (3 bytes)
Sending DISCONNECT

```

But the command never gets to the light, and I see nothing on my MQTT box that is connected to the broker at 192.168.1.124 and subscribed to the cmnd/desklight/power topic.

Does anyone see what my problem may be?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 April 2020 04:41 UTC](https://discourse.nodered.org/t/mosquitto-pub-help-please/24559/2 "2020-04-10T04:41:15Z")

</div>

For starters,

`mqtt_sub -h 192.168.1.124 -t cmnd/desklight/#`

Enter the command from another _terminal_ (same or different machine) and see what you get.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 April 2020 07:45 UTC](https://discourse.nodered.org/t/mosquitto-pub-help-please/24559/3 "2020-04-10T07:45:52Z")

</div>

> [@SteveMann](#):
>
> mosquitto\_pub -h 192.168.1.124 -t cmnd/desklight/power/ -m "on" -d

You should not have a trailing `/` on the topic, though I don't know whether that is the problem.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [10 April 2020 10:32 UTC](https://discourse.nodered.org/t/mosquitto-pub-help-please/24559/4 "2020-04-10T10:32:51Z")

</div>

Use a tool like [Mqtt-explorer](http://mqtt-explorer.com/) to see what's really on the "wire"

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [10 April 2020 12:49 UTC](https://discourse.nodered.org/t/mosquitto-pub-help-please/24559/5 "2020-04-10T12:49:44Z")

</div>

_" For starters,_  
_`mqtt_sub -h 192.168.1.124 -t cmnd/desklight/#`_  
_Enter the command from another terminal (same or different machine) and see what you get."_  
This works

_" You should not have a trailing `/` on the topic, though I don't know whether that is the problem."_  
That was it. I hoped it would be something subtle like that.

_" Use a tool like [Mqtt-explorer](http://mqtt-explorer.com/) to see what's really on the "wire""_  
Thanks for the reminder. I hadn't used that tool in quite a while, and forgot that I had it.

---

<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:** [24 April 2020 12:59 UTC](https://discourse.nodered.org/t/mosquitto-pub-help-please/24559/6 "2020-04-24T12:59:06Z")

</div>

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