# MQTT-In Not Connecting

**URL:** <https://discourse.nodered.org/t/mqtt-in-not-connecting/17325>\
**Category:** General\
**Created:** [30 October 2019 12:24 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325 "2019-10-30T12:24:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![robomike](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@robomike](https://discourse.nodered.org/u/robomike)\
**Post date:** [30 October 2019 12:24 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/1 "2019-10-30T12:24:17Z")

</div>

Hi All,

I have the latest npm node-red version, embedded into an express application. When I run node-red locally, or in a heroku instance , neither node-red instance mqtt-in connects. The node just is a constant disconnect. I have verified my mqtt settings with MQTT Explorer , and that connects with no issue. There are no errors on the console, or in the debug window console.

What could be wrong?

Mike

---

<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:** [30 October 2019 12:37 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/2 "2019-10-30T12:37:36Z")

</div>

Look in the the log for the mqtt server to see if there is anything there.  
Are you running mqtt explorer in the same machine as node red?  
Where is your mqtt server?

---

<div class="post-metadata">

**Author:** ![robomike](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@robomike](https://discourse.nodered.org/u/robomike)\
**Post date:** [30 October 2019 13:50 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/3 "2019-10-30T13:50:33Z")

</div>

Hi Colin,

Mqtt Explorer is on the same machine as code red. I do not have access to the backend of the remote mqtt broker, but shouldn't the mqtt-in red bubble, at least turn yellow for connecting? It just seems it's not working.  
Mike

---

<div class="post-metadata">

**Author:** ![robomike](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@robomike](https://discourse.nodered.org/u/robomike)\
**Post date:** [30 October 2019 14:31 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/4 "2019-10-30T14:31:10Z")

</div>

The same thing is happening with [test.mosquitto.org](http://test.mosquitto.org) as the mqtt server. ....

---

<div class="post-metadata">

**Author:** ![robomike](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@robomike](https://discourse.nodered.org/u/robomike)\
**Post date:** [30 October 2019 14:39 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/5 "2019-10-30T14:39:35Z")

</div>

actually [mosquitto.org](http://mosquitto.org) works, so probably some settings in mqtt

---

<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:** [30 October 2019 16:11 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/6 "2019-10-30T16:11:12Z")

</div>

Show us the settings you use in mqtt explorer and in the mqtt node.  
Also which version of node.js are you using? Run `node -v` in a terminal to find out.

---

<div class="post-metadata">

**Author:** ![robomike](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@robomike](https://discourse.nodered.org/u/robomike)\
**Post date:** [30 October 2019 22:24 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/7 "2019-10-30T22:24:34Z")

</div>

i got it working, it was wrong settings on the topic and user name , sorry for wasting your time and thank you very much for your help!

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [4 November 2019 15:29 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/9 "2019-11-04T15:29:25Z")

</div>

find a cloud mqtt service such as [https://www.cloudmqtt.com/](https://www.cloudmqtt.com/)

---

<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:** [4 November 2019 17:17 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/10 "2019-11-04T17:17:03Z")

</div>

or install your own mosquitto broker on your server

or you can run your own broker within Node-RED itself [https://flows.nodered.org/node/node-red-contrib-mqtt-broker](https://flows.nodered.org/node/node-red-contrib-mqtt-broker)

---

<div class="post-metadata">

**Author:** ![mirou\_IoT](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mirou\_IoT](https://discourse.nodered.org/u/mirou_IoT)\
**Post date:** [5 November 2019 07:34 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/11 "2019-11-05T07:34:53Z")

</div>

thanks for help but I use node red with remote server 176.31 .... not cloudMQTT

---

<div class="post-metadata">

**Author:** ![mirou\_IoT](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mirou\_IoT](https://discourse.nodered.org/u/mirou_IoT)\
**Post date:** [5 November 2019 07:37 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/12 "2019-11-05T07:37:04Z")

</div>

thank you for help but i installed the mqtt broker but i want to use the server 176.31.... not localhost

---

<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:** [5 November 2019 07:51 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/13 "2019-11-05T07:51:21Z")

</div>

> [@mirou\_IoT](#):
>
> but i want to use the server 176.31.... not localhost

Can you install mosquitto on 176.31....

---

<div class="post-metadata">

**Author:** ![mirou\_IoT](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mirou\_IoT](https://discourse.nodered.org/u/mirou_IoT)\
**Post date:** [5 November 2019 07:56 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/14 "2019-11-05T07:56:53Z")

</div>

how ??? if you want i sent you the flow in node red  
i use raspberry also

---

<div class="post-metadata">

**Author:** ![mirou\_IoT](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mirou\_IoT](https://discourse.nodered.org/u/mirou_IoT)\
**Post date:** [5 November 2019 08:00 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/15 "2019-11-05T08:00:23Z")

</div>

i use server 176.31..., raspberry , dht sensor and led i want to use MQTT to show the value of temperature and humidity in dashborad of node red and the server is 176.31.... not localhost

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [5 November 2019 08:08 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/16 "2019-11-05T08:08:21Z")

</div>

To try understand what you are trying to do.

What I understand is:  
You have a local raspberry pi and you want to use MQTT to send data to a remote Node-RED.

MQTT work by your pi publishing to a broker and Node-RED subscribing.

So you need to find a broker that your pi and Node-RED can see.

You have been given two options.  
Either use someone else’s broker or install your own. Both you have said no to, but without saying why. Both would work in the situation as I understand it.

If my understanding is wrong you need to explain why.  
If the understanding is correct you need to explain why the two solutions are not acceptable to you

---

<div class="post-metadata">

**Author:** ![mirou\_IoT](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mirou\_IoT](https://discourse.nodered.org/u/mirou_IoT)\
**Post date:** [5 November 2019 08:17 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/17 "2019-11-05T08:17:49Z")

</div>

thank you for help , your indrestanding is correct , i use the local raspberry and i want to use the MQTT to send data to a remote NODE -RED i use the [test.mosquitto.org](http://test.mosquitto.org) and the [mqtt.eclipse.org](http://mqtt.eclipse.org) port 1883 it works but if want to use the 176.31.21...broker the mqtt node disconnected , i can't use the cloudMQTT because in this project i should use the NODE RED

---

<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:** [5 November 2019 08:27 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/18 "2019-11-05T08:27:44Z")

</div>

> [@mirou\_IoT](#):
>
> i can't use the cloudMQTT because in this project i should use the NODE RED

CloudMQTT and Node-RED are completely different things. CloudMQTT is a cloud-hosted MQTT broker service that you _could_ use as a broker that both of your raspberryPis (running Node-RED) can see and connect to.

> [@mirou\_IoT](#):
>
> but if want to use the 176.31.21...broker the mqtt node disconnected

Can you clarify what you mean by the 176...broker? Do you mean you have installed an MQTT broker (such as mosquitto) on one of your devices?

---

<div class="post-metadata">

**Author:** ![mirou\_IoT](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mirou\_IoT](https://discourse.nodered.org/u/mirou_IoT)\
**Post date:** [5 November 2019 08:31 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/19 "2019-11-05T08:31:35Z")

</div>

@knolleary  
the 176.31...is the broker that i have installed (such as mosquitto) on my device

---

<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:** [5 November 2019 08:36 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/20 "2019-11-05T08:36:13Z")

</div>

> [@mirou\_IoT](#):
>
> is the broker that i have installed

Are the two devices on the same local network?

---

<div class="post-metadata">

**Author:** ![mirou\_IoT](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mirou\_IoT](https://discourse.nodered.org/u/mirou_IoT)\
**Post date:** [5 November 2019 08:44 UTC](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325/21 "2019-11-05T08:44:51Z")

</div>

@knolleary the two devices are the raspberry connected in my local network and the other device is the remote NODE-RED

[Next page](https://discourse.nodered.org/t/mqtt-in-not-connecting/17325.md?page=2)
