# No data Recevied with MQTT IN

**URL:** <https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284>\
**Category:** General\
**Tags:** mqtt\
**Created:** [31 May 2022 08:24 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284 "2022-05-31T08:24:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 08:24 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/1 "2022-05-31T08:24:12Z")

</div>

Hi, This is my first question to this forum. Sorry, If I make a mistake in question format.  
I use ESP32 to send CAN protocol frames and I am able to get data using python paho succesfully. (python script is attached).  
But I couldn't get data using node-red platform, it connects, but there is no data is received? Where is my mistake?

 ![Screenshot 2022-05-31 112220](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/8477998410a807e53d94b6cc8ff93c3ebd3d67b9.png)  
 ![Screenshot 2022-05-31 112338](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40ccbf8aa82cec5c8fb0488775f3c254245bfe65.png)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [31 May 2022 08:37 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/2 "2022-05-31T08:37:09Z")

</div>

Welcome to the forum!

Can you show how you have configured the MQTT in node, this is the configuration node.  
Looking at the node label of the MQTT node on the left it looks like you are trying to subscribe to #. In your Python node you subscribe to /CAN/#.

---

<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:** [31 May 2022 08:44 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/3 "2022-05-31T08:44:21Z")

</div>

Hi @berkerali welcome to the forum.

Few things...

1. I see in your 1st screenshot you subscribe PAHO to `/CAN/#` but in node-red you subscribe to `#`. Firstly: some brokers do not permit access to `#` (I am pretty sure EMQX is one of those). Also, since `broker.emqx.io` is a public broker there will probably be MILLIONS of payloads hitting that MQTT topic filter per second - not wise at all.

2. You should not start a topic with a `/` e.g. `can/device-id/status` is a far better topic. Infact since `broker.emqx.io` is a public broker, you should either use a more distinct topic (e.g. `berkarali-public-data/can/device-id/status`) or change to a private cloud MQTT or your own broker (e.g. a local EMQX or MOSQUITO)

Hope that helps.

---

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 09:36 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/4 "2022-05-31T09:36:50Z")

</div>

Actually, I've tried much more possibility including CAN/#.  
 ![Screenshot 2022-05-31 123540](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9c1070b907aacdfffbb89b13ffabd3d2bf7fcbd5.png)

---

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 09:43 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/5 "2022-05-31T09:43:38Z")

</div>

1. I use **/CAN/engine** while sending data, # just for the the test at the start. Even though I've changed **/CAN/engine** topic I couldn't get data. Still I always get data in python script.
2. First time I hear this information. Works in python too?

---

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 09:45 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/6 "2022-05-31T09:45:27Z")

</div>

![Screenshot 2022-05-31 124434](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f7ccac211cfc75185d355c9f39678984f7262063.png)

---

<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:** [31 May 2022 09:48 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/7 "2022-05-31T09:48:58Z")

</div>

> [@berkerali](#):
>
> First time I hear this information

From [MQTT Topics, Wildcards, & Best Practices – MQTT Essentials: Part 5](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/) ...

> ### MQTT Best practices
> 
> #### Never use a leading forward slash
> 
> A leading forward slash is permitted in MQTT. For example, **/myhome/groundfloor/livingroom**. However, the leading forward slash introduces an unnecessary topic level with a zero character at the front. The zero does not provide any benefit and often leads to confusion.

> [@berkerali](#):
>
> Actually, I've tried much more possibility including CAN/#.

Works for me!  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/4/f46be3a6f260620e8b2ed35878d36ec675efbe22.png)

```auto
[{"id":"41fa41950c07ae96","type":"mqtt in","z":"55525a9d18c99b86","name":"","topic":"/CAN/#","qos":"2","datatype":"auto","broker":"dc811dae.05f5","nl":false,"rap":true,"rh":0,"inputs":0,"x":950,"y":628,"wires":[["39948fe0b7bc780f"]]},{"id":"39948fe0b7bc780f","type":"debug","z":"55525a9d18c99b86","name":"/CAN/#","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":1160,"y":628,"wires":[]},{"id":"6095145b8b5e8c13","type":"inject","z":"55525a9d18c99b86","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"/CAN/engine","payload":"works for me!","payloadType":"str","x":1010,"y":580,"wires":[["84389b84871e7032"]]},{"id":"84389b84871e7032","type":"mqtt out","z":"55525a9d18c99b86","name":"mqtt out","topic":"","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"dc811dae.05f5","x":1200,"y":580,"wires":[]},{"id":"dc811dae.05f5","type":"mqtt-broker","name":"","broker":"broker.emqx.io","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"5","keepalive":"50","cleansession":true,"birthTopic":"testing123/birth","birthQos":"0","birthPayload":"123","birthMsg":{"contentType":"text/plain","userProps":"{\"birthprop\":\"123\"}","respTopic":"testing123/birth-resp","correl":"birth-correl","expiry":"9999"},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"testing123/will","willQos":"0","willPayload":"123","willMsg":{"contentType":"application/json","userProps":"{\"willprop\":\"123\"}","respTopic":"testing123/will-resp","correl":"will-correl","expiry":"888","delay":"12"},"userProps":"","sessionExpiry":""}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 May 2022 09:58 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/8 "2022-05-31T09:58:48Z")

</div>

Well I can confirm that [broker.emqx.io](http://broker.emqx.io) does not allow you to subscribe to # (No messages arrive at all)  
But if one is foolish enough to subscribe to /# , a shedload of [other people's] messages show up!

---

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 10:08 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/9 "2022-05-31T10:08:21Z")

</div>

why are you insulting? Foolish ? python worked and stayed that way. It can. We can also make mistakes.

---

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 10:10 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/10 "2022-05-31T10:10:39Z")

</div>

What does it mean? Where is my wrong?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [31 May 2022 10:12 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/11 "2022-05-31T10:12:00Z")

</div>

I think you might have misunderstood what @jbudd was saying. If you use a top level topic of `#` that says 'subscribe to everything that is published by anyone.' Now if you were to subscribe to `CAN/#` that says to subscribe to everything that gets published with `CAN` as the top level of the topic.`

---

<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:** [31 May 2022 10:13 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/12 "2022-05-31T10:13:23Z")

</div>

> [@berkerali](#):
>
> why are you insulting? Foolish ?

@berkerali please dont read it wrong, JBudd is not calling you foolish (he is merely saying it would be foolish to subscribe to `#` because millions of payloads will travel over the internet to your computer)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 May 2022 10:13 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/13 "2022-05-31T10:13:28Z")

</div>

Is someone insulting?

Did you try importing @Steve-Mcl's flow and see if it works for you?

---

<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:** [31 May 2022 10:15 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/14 "2022-05-31T10:15:15Z")

</div>

> [@berkerali](#):
>
> What does it mean? Where is my wrong

Sorry, I dont understand what are you saying here?

Could you try to import the demo flow I provided - does it work for you?

If not, then tell us more about your node-red setup (does it have access to internet? what version of nodejs and node-red are you using? etc)

---

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 10:15 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/15 "2022-05-31T10:15:37Z")

</div>

I think. No need to use foolish word. Others may have used it accidentally (especially beginners). This is not stupidity, it is a mistake.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 May 2022 10:16 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/16 "2022-05-31T10:16:04Z")

</div>

ahhh it was me!

No, I was not insulting you, I was actually referring to the fact that when I subscribed to /#, my Node-red system was immediately overwhelmed.

I apologise for not making that clear.

---

<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:** [31 May 2022 10:17 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/17 "2022-05-31T10:17:38Z")

</div>

> [@jbudd](#):
>
> I was actually referring to the fact that when I subscribed to /#, my Node-red system was immediately overwhelmed.

That is very telling - it means there are a LOT of people posting to `/something` - imagine EMQX actually allowed you to subscribe to `#` - 💥

---

<div class="post-metadata">

**Author:** ![berkerali](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@berkerali](https://discourse.nodered.org/u/berkerali)\
**Post date:** [31 May 2022 10:18 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/18 "2022-05-31T10:18:13Z")

</div>

![Screenshot 2022-05-31 131231](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/a/1a7f78edf8f945c1eadfdd432678ac1b421c104d.png)

I see messages in my flow. Btw, how can I import your demo flow?

---

<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:** [31 May 2022 10:19 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/19 "2022-05-31T10:19:17Z")

</div>

Copy the posted flow and use `CTRL+i` to import.

If you dont mind me saying, you might benefit from some tutorials? I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<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:** [31 May 2022 10:19 UTC](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284/20 "2022-05-31T10:19:54Z")

</div>

> [@berkerali](#):
>
> I see messages in my flow

Then it is **definitely** working. Perhaps your device is not publishing values?

[Next page](https://discourse.nodered.org/t/no-data-recevied-with-mqtt-in/63284.md?page=2)
