# Oh great! Now my MQTT is not working!

**URL:** <https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652>\
**Category:** General\
**Created:** [6 February 2019 11:47 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652 "2019-02-06T11:47:34Z")\
**Posts on this page:** 13\
**Page:** 2

<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:** [6 February 2019 22:15 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/22 "2019-02-06T22:15:20Z")

</div>

If you delete the unwanted one then it is easier to see the ones that need fixing as they will have the red triangle against them.

---

<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:** [6 February 2019 22:35 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/23 "2019-02-06T22:35:17Z")

</div>

> [@Trying\_to\_learn](#):
>
> I see the list. (see attached) but I can't resolve how to delete them.

Double click on each one in turn to open its edit dialog and click the delete button.

---

<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:** [7 February 2019 03:00 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/24 "2019-02-07T03:00:46Z")

</div>

The story continues.

Got home, turned on (this) machine.

Logged in.

Down to 3 using the "wrong" node. Shall have to find them.

Deleted the rest.

But, in the mean time, the MQTT is working nicely.

Me and my big mouth.....  
All done. Deleted (from the list) the un-wanted MQTT node and went around editing the ones with errors.

Set them to the right one.

DEPLOY.

MQTT down.

Well, it is `disconnected` and blinks `connected` every few seconds for a short while then reverts to `disconnected`.

Looking at the MQTT log, this is at the bottom:

```auto
1549508892: New client connected from 192.168.0.99 as mqtt_a36ec996.601568 (c1, k60).
1549508892: Socket error on client mqtt_a36ec996.601568, disconnecting.
1549508907: New connection from 192.168.0.99 on port 1883.
1549508907: New client connected from 192.168.0.99 as mqtt_a36ec996.601568 (c1, k60).
1549508907: Socket error on client mqtt_a36ec996.601568, disconnecting.
1549508922: New connection from 192.168.0.99 on port 1883.
1549508922: New client connected from 192.168.0.99 as mqtt_a36ec996.601568 (c1, k60).
1549508922: Socket error on client mqtt_a36ec996.601568, disconnecting.
1549508937: New connection from 192.168.0.99 on port 1883.

```

So "who" is this mqtt\_a36ec996.601568?  
A tab? A flow? A node?

I know it keeps changing every time I go through the process, but it must mean something.

I'll keep digging.

(And something else.....)  
This machine's NR.  
All MQTT nodes connected.

---

<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:** [7 February 2019 09:08 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/25 "2019-02-07T09:08:44Z")

</div>

> [@Trying\_to\_learn](#):
>
> So "who" is this mqtt\_a36ec996.601568?

That is the mqtt config node in node-red.  
It seems possible you have a network issue of some sort. On the failing machine do what I suggested before, in a terminal run  
`ping <ip address of host machine>`  
and leave it running until the connections start failing. Do you see anything interesting? Does it hang? Do the times get much longer?  
 is the ip address of the machine running mosquitto obviously.

---

<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:** [7 February 2019 09:51 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/26 "2019-02-07T09:51:28Z")

</div>

> [@Colin](#):
>
> That is the mqtt config node in node-red.  
> It seems possible you have a network issue of some sort. On the failing machine do what I suggested before, in a terminal run  
> `ping <ip address of host machine>`  
> and leave it running until the connections start failing. Do you see anything interesting? Does it hang? Do the times get much longer?  
> is the ip address of the machine running mosquitto obviously.

I think there is some miss-understanding on the machines.

The mqtt config node. Ok, that is on `timepi`.  
The _failing machine_ is the one which is running the mqtt server/host.

Weirdly enough the machine (`timepi`) pings all the machines at regular intervals - like every 6 or 10 seconds.

The load on the machine is running at about 50-80% with peaks to 100% now and then when it is pinging.

What do you mean by the last line:

> [@Colin](#):
>
> is the ip address of the machine running mosquitto obviously.

I've (in the mean time) gone though and edited all the MQTT nodes again and got rid of all the _unused nodes_ and found a few still using the wrong name.

So, other than the time for the pings....... But they will/may vary depending on the machine's load (`timepi`) sending the pings.  
And yes, it pings itself.

It is to determine if the machine is online or not.

---

<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:** [7 February 2019 14:02 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/27 "2019-02-07T14:02:09Z")

</div>

I think we are all confused now.

1. What is the ip address of the mqtt server machine
2. What is the ip address of the other machine?
3. Are you running node-red on both machines?

---

<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:** [7 February 2019 19:50 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/28 "2019-02-07T19:50:24Z")

</div>

In answer to your questions:  
1 - 192.168.0.99  
2 - This machine (I'm confused with "other") is .146  
3 - Yes.

And as anticipation:  
This machine's MQTT nodes are ok.  
Some of the nodes on .99 are ok. Some aren't.  
Nodes on another RPI running NR are also connected. That IP address is .93

Can you clarify that part about:  
_is the ip address of the machine running mosquitto obviously._

---

<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:** [7 February 2019 20:41 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/29 "2019-02-07T20:41:13Z")

</div>

> [@Trying\_to\_learn](#):
>
> Can you clarify that part about:  
> _is the ip address of the machine running mosquitto obviously._

I assumed that you were using mosquitto as your mqtt host. Is that not the case? But all along I have been confused about which machine is which...  
I understand now some more of what you have been saying.  
The errors you have been getting in the log are things like

```auto
1549508922: New client connected from 192.168.0.99 as mqtt_a36ec996.601568 (c1, k60).
1549508922: Socket error on client mqtt_a36ec996.601568, disconnecting.

```

That is saying that the mqtt config node `a36ec996.601568` in `192.168.0.99` is connecting and then failing.  
So that means you have to look at the mqtt config node(s) on the mqtt server machine.  
So see if you have a similar situation there with repeated config nodes. I would expect the config node on the mqtt server machine to be configured to use localhost rather than a specific ip address. If you only have one then show us how it is connected. If you have more than one then delete the extra ones as you have on the other machine.

---

<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:** [7 February 2019 20:51 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/30 "2019-02-07T20:51:56Z")

</div>

Ok, in reply.

I have only one MQTT broker/host/machine.

The other day all/most of the MQTT nodes went **disconnected** and flashed **connecting** , then briefly **connected** before returning to **disconnected**.

That was on the same machine as the broker/host

I was looking to resolve this `a36ec996.601568` on that machine but couldn't.

Meanwhile......

I sat down and tidied up all the _unused_ nodes and rationalised all the MQTT nodes which I had mistakenly stuffed up earlier on.

Nick had told me to give it a name rather than the IP address.

So, after editing abut 90 nodes, they are all now _happy_ (er) than before.

Alas there were still problems.

Some of the nodes were disconnected. Some connected. (On THAT machine.)  
I looked at the MQTT nodes on THIS machine and they were all connected.  
I also powered up another RPI. All its MQTT nodes were happy.

I sat down and disabled tabs trying to work out where the problem is.

This took hours.

I didn't really get anything helpful.

So that is where I am at.

**just now** everyone is happy.

That isn't to say in 3 minutes they will not spit the dummy again and stop working.

---

<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:** [7 February 2019 21:00 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/31 "2019-02-07T21:00:28Z")

</div>

Well all the mqtt log errors that you have been posted have been connection problems on 0.99

Perhaps in future when you have problems like this it would be best only to use the ip addresses when posting here, so we will not be confused about the multiple machines.

Thinking about the mqtt errors in the log, you will get reconnection each time you deploy the config nodes of course. Perhaps that is what you have been seeing there.

However you say everything is ok now, so lets hope it stays that way.

---

<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:** [7 February 2019 23:07 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/32 "2019-02-07T23:07:15Z")

</div>

Me too.

I was only mentioning other machines because to me it is strange that:  
On 0.99 (the broker/host) some/all the MQTT nodes are not working.

Yet, on another machine (say 0.146) the MQTT nodes **are** working, when it is using the same broker/host as 0.99.

Then!  
When some of 0.99 nodes are connected and some aren't..... That really throws a spanner in the works.

---

<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:** [7 February 2019 23:21 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/33 "2019-02-07T23:21:17Z")

</div>

> [@Trying\_to\_learn](#):
>
> When some of 0.99 nodes are connected and some aren't.

The last time you reported you had some nodes connected and some not (a few weeks ago), our repeated advice was to get all of your mqtt nodes using the _same_ mqtt-broker config node - that way they share the same connection. The fewer connections you have, the fewer things to go wrong.

---

<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:** [8 February 2019 08:09 UTC](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652/34 "2019-02-08T08:09:21Z")

</div>

Well, as of not long ago from now, they all are.

I have about 90+ MQTT nodes on that machine.

So, all good for now.

[Previous page](https://discourse.nodered.org/t/oh-great-now-my-mqtt-is-not-working/7652.md?page=1)
