openhab MQTT connection lost
Moderators: grovkillen, Stuntteam, TD-er
openhab MQTT connection lost
Hi,
I am using R78 with openhab and Mosquitto. All seems to connect just fine but if you watch the log the ESP will send three temperature transmissions followed by "MQTT : Connection lost
MQTT : Connected to broker" . This increases the error count. when the error count reaches 30 the ESP reboots. R48 does not do this. R48 will connect and run for days without a single connection error! I think something broke after R48.
Here is a snippet of the ESP log:
connected with shangrila, channel 1
ip:192.168.0.53,mask:255.255.255.0,gw:192.168.0.1
WIFI : Connected!
MQTT : Connected to broker
Subscribed to: /Studiolights/#
INIT : Boot OK
INIT : Normal boot
WD : Uptime 0 ConnectFailures 0 FreeMem 26096
MQTT : Connection lost
MQTT : Connected to broker
Subscribed to: /Studiolights/#
DS : Temperature: 27.56 (28-ff-f5-66-a6-15-4-f0)
MQTT : Topic: /Studiolights/temp/Temperature F
MQTT : Payload: 81.61
DS : Temperature: 27.56 (28-ff-f5-66-a6-15-4-f0)
DS : Temperature: 27.56 (28-ff-f5-66-a6-15-4-f0)
WD : Uptime 1 ConnectFailures 2 FreeMem 25920
MQTT : Connection lost
MQTT : Connected to broker
Subscribed to: /Studiolights/#
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
MQTT : Topic: /Studiolights/temp/Temperature F
MQTT : Payload: 81.72
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
WD : Uptime 1 ConnectFailures 4 FreeMem 25840
MQTT : Connection lost
MQTT : Connected to broker
Subscribed to: /Studiolights/#
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
MQTT : Topic: /Studiolights/temp/Temperature F
MQTT : Payload: 81.72
Also it would be nice to get the Event task back. This was useful to turn on local lights etc with local switches but still allow full computer control.
Thanks
I am using R78 with openhab and Mosquitto. All seems to connect just fine but if you watch the log the ESP will send three temperature transmissions followed by "MQTT : Connection lost
MQTT : Connected to broker" . This increases the error count. when the error count reaches 30 the ESP reboots. R48 does not do this. R48 will connect and run for days without a single connection error! I think something broke after R48.
Here is a snippet of the ESP log:
connected with shangrila, channel 1
ip:192.168.0.53,mask:255.255.255.0,gw:192.168.0.1
WIFI : Connected!
MQTT : Connected to broker
Subscribed to: /Studiolights/#
INIT : Boot OK
INIT : Normal boot
WD : Uptime 0 ConnectFailures 0 FreeMem 26096
MQTT : Connection lost
MQTT : Connected to broker
Subscribed to: /Studiolights/#
DS : Temperature: 27.56 (28-ff-f5-66-a6-15-4-f0)
MQTT : Topic: /Studiolights/temp/Temperature F
MQTT : Payload: 81.61
DS : Temperature: 27.56 (28-ff-f5-66-a6-15-4-f0)
DS : Temperature: 27.56 (28-ff-f5-66-a6-15-4-f0)
WD : Uptime 1 ConnectFailures 2 FreeMem 25920
MQTT : Connection lost
MQTT : Connected to broker
Subscribed to: /Studiolights/#
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
MQTT : Topic: /Studiolights/temp/Temperature F
MQTT : Payload: 81.72
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
WD : Uptime 1 ConnectFailures 4 FreeMem 25840
MQTT : Connection lost
MQTT : Connected to broker
Subscribed to: /Studiolights/#
DS : Temperature: 27.62 (28-ff-f5-66-a6-15-4-f0)
MQTT : Topic: /Studiolights/temp/Temperature F
MQTT : Payload: 81.72
Also it would be nice to get the Event task back. This was useful to turn on local lights etc with local switches but still allow full computer control.
Thanks
-
- Normal user
- Posts: 44
- Joined: 31 Jan 2016, 21:05
Re: openhab MQTT connection lost
I had the same problems when more then 1 ESP** was connecting to the broker.
It turned out that the device number (in the config screen) has to be unique and not zero ... This solved my problem !
-ben
It turned out that the device number (in the config screen) has to be unique and not zero ... This solved my problem !
-ben
Re: openhab MQTT connection lost
Ben,
You, my friend, are awesome!!! I can now go bandage my head from beating it against the keyboard for the last week! This field should be documented better (or at all). I gave all of my ESP units a unique number and all my problems went away.
Thanks again
Dave
You, my friend, are awesome!!! I can now go bandage my head from beating it against the keyboard for the last week! This field should be documented better (or at all). I gave all of my ESP units a unique number and all my problems went away.
Thanks again
Dave
-
- Normal user
- Posts: 44
- Joined: 31 Jan 2016, 21:05
Re: openhab MQTT connection lost
Hi,
EaspEasy is a very nice product, people must have spend hours and hours to get it working (which is very much appreciated) but it lacks information like this.
Or at least it is difficult to find but this is why this forum is here !
-ben
EaspEasy is a very nice product, people must have spend hours and hours to get it working (which is very much appreciated) but it lacks information like this.
Or at least it is difficult to find but this is why this forum is here !
-ben
Re: openhab MQTT connection lost
That is exactly what I was looking for. Could you help me where could I find more about it?dduley wrote: Also it would be nice to get the Event task back. This was useful to turn on local lights etc with local switches but still allow full computer control.
Thanks in advance.
Re: openhab MQTT connection lost
Try going to the github site and look under "plugin playground". The event plugin is there
Re: openhab MQTT connection lost
Thank you.
Re: openhab MQTT connection lost
crap! was testing with one unit with mqtt, that was working perfectly. Later in a 'quick', I added a second one, since then it was working but sometimes not.bennybubble wrote: ↑18 Feb 2016, 11:04 I had the same problems when more then 1 ESP** was connecting to the broker.
It turned out that the device number (in the config screen) has to be unique and not zero ... This solved my problem !
-ben
Because they were default unit no:0...
I know that the unit no was important, but thought it was something else.
Was checking rbpi config, domoticz,...
Code: Select all
66756 : MQTT : Connection lost
67802 : MQTT : Connected to broker
67807 : Subscribed to: domoticz/out

Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.
Re: openhab MQTT connection lost
Hello everyone, I still have this problem.
I have 26 devices in the network and each of them has a unique “Unit Number” value. I use different firmware versions (R147, R148, v2.0.0-dev12, mega-20181122, mega-20181231, mega-20190511).
Version of OH 2.5.5.
I was temporarily forced to add a rule to an individual node to reboot in case of loss of mqtt connection. But I really don’t want to keep that long-term.
Anyone any idea?
thanks for the help
I have 26 devices in the network and each of them has a unique “Unit Number” value. I use different firmware versions (R147, R148, v2.0.0-dev12, mega-20181122, mega-20181231, mega-20190511).
Version of OH 2.5.5.
I was temporarily forced to add a rule to an individual node to reboot in case of loss of mqtt connection. But I really don’t want to keep that long-term.
Anyone any idea?
thanks for the help
Re: openhab MQTT connection lost
Have you also tried a more recent build?
A lot improvements have been made since 201905...
A lot improvements have been made since 201905...
Re: openhab MQTT connection lost
I haven't succeeded yet
.... At the same time I have three sonoff pow r2 for which only the mega-20181231 version is available. Am I wrong?
For other nodes I will try a newer version of FW.
Thanks for the tip

For other nodes I will try a newer version of FW.
Thanks for the tip

Re: openhab MQTT connection lost
See here: https://github.com/letscontrolit/ESPEasy/releases
I just checked one of the latest builds and in there is the ESP_Easy_mega_20200812_hard_SONOFF_POW_4M1M.bin
So you should be possible to OTA to one of the newer builds for Sonoff POW units.
N.B. when upgrading from an older build, only use the .bin file and not the .bin.gz file as that one can only be used on very recent builds.
I just checked one of the latest builds and in there is the ESP_Easy_mega_20200812_hard_SONOFF_POW_4M1M.bin
So you should be possible to OTA to one of the newer builds for Sonoff POW units.
N.B. when upgrading from an older build, only use the .bin file and not the .bin.gz file as that one can only be used on very recent builds.
Re: openhab MQTT connection lost
I performed an FW upgrade to "ESPEasy_ESP82xx_mega-20200812". Nevertheless, I have noticed that the mqtt connection continues to be lost from time to time.TD-er wrote: ↑19 Aug 2020, 21:59 See here: https://github.com/letscontrolit/ESPEasy/releases
I just checked one of the latest builds and in there is the ESP_Easy_mega_20200812_hard_SONOFF_POW_4M1M.bin
So you should be possible to OTA to one of the newer builds for Sonoff POW units.
N.B. when upgrading from an older build, only use the .bin file and not the .bin.gz file as that one can only be used on very recent builds.
Maybe some other idea?
thx
Re: openhab MQTT connection lost
1. This problem might be related to specific module hardware.I performed an FW upgrade to "ESPEasy_ESP82xx_mega-20200812". Nevertheless, I have noticed that the mqtt connection continues to be lost from time to time.
Maybe some other idea?
Check all your devices to see which are affected by the MQTT problem. Please list which ESP8266 modules are affected (module brand and model number).
2. The problem might be related to intermittent weak RF signal conditions.
Temporarily move an affected ESP8266 module so it is within a couple meters of the WiFi router. Does the random lost MQTT connection issue go away?
3. The problem might be related to the power supply. If the problem occurs on modules that use external 5V power then try a different wall wart supply. Avoid cheap wall warts, these tend to be the source of headaches.
4. On the affected devices, have you ever noticed slow page loads when you web browse the various ESPEasy configuration pages?
- Thomas
Re: openhab MQTT connection lost
Hi TomasThomasB wrote: ↑21 Aug 2020, 20:261. This problem might be related to specific module hardware.I performed an FW upgrade to "ESPEasy_ESP82xx_mega-20200812". Nevertheless, I have noticed that the mqtt connection continues to be lost from time to time.
Maybe some other idea?
Check all your devices to see which are affected by the MQTT problem. Please list which ESP8266 modules are affected (module brand and model number).
2. The problem might be related to intermittent weak RF signal conditions.
Temporarily move an affected ESP8266 module so it is within a couple meters of the WiFi router. Does the random lost MQTT connection issue go away?
3. The problem might be related to the power supply. If the problem occurs on modules that use external 5V power then try a different wall wart supply. Avoid cheap wall warts, these tend to be the source of headaches.
4. On the affected devices, have you ever noticed slow page loads when you web browse the various ESPEasy configuration pages?
- Thomas
Answer the questions:
1. Node model: Sonoff pow r2
2. The Internet network consists of two mikrotik routers that have WiFi configured in mesh mode. They are connected to each other with utp.
3. Power supply is thus exempted as the nodes are connected to 230V, ie according to the manufacturer's connection scheme.
4. I didn't notice the slow performance of the gui
Thx for help

Re: openhab MQTT connection lost
If the problem only occurs on your Sonoff Pow R2 modules then perhaps this particular Sonoff module is inviting the problem. It could be similar to the WiFi performance issue that is suffered by the Sonoff Basic R2 V1.0 hardware that is running ESPEasy.1. Node model: Sonoff pow r2
Assuming my hunch is correct, the only practical workaround is to try older ESPEasy versions and cherry pick a release that is the most reliable. Or continue using your special rule that reboots the device when the MQTT connection is lost for an extended period.
- Thomas
Re: openhab MQTT connection lost
Sonoff Basic R2 is crucial to me. However, the same problem occurs with the NodeMCU ESP8266 v1, but I did not notice this with the Wemos D1.ThomasB wrote: ↑21 Aug 2020, 21:37If the problem only occurs on your Sonoff Pow R2 modules then perhaps this particular Sonoff module is inviting the problem. It could be similar to the WiFi performance issue that is suffered by the Sonoff Basic R2 V1.0 hardware.1. Node model: Sonoff pow r2
Assuming my hunch is correct, the only practical workaround is to try older ESPEasy versions and cherry pick a release that is the most reliable. Or continue using your special rule that reboots the device when the MQTT connection is lost for an extended period.
- Thomas
Until I find out, a special rule will stay alive

Thx for Help
Re: openhab MQTT connection lost
My installation uses OpenHab2 MQTT and has some Lolin NodeMCU V3 devices that utilize the MQTT broker. They all have the mega-20200222 [Testing] release. I haven't encountered lost MQTT connections with any of my NodeMCUs.However, the same problem occurs with the NodeMCU ESP8266 v1, but I did not notice this with the Wemos D1.
Below is a screenshot of my typical controller settings (for comparison to your configuration):
- Thomas
Re: openhab MQTT connection lost
This is my OH2 configuration. And a correction of the previous post I have NodeMCU ESP8266 v3 not v1.
Re: openhab MQTT connection lost
Our controller settings are similar. However, I'm using the mega-20200222 [Testing] release (ESP_Easy_mega-20200222_test_ESP8266_4M1M_VCC.bin) on my NodeMCU devices. This combination has been stable/reliable.
- Thomas
- Thomas
Re: openhab MQTT connection lost
I'm using the ESP_Easy_mega_20200812_normal_ESP8266_4M1M.bin and just checked the connection status of NodeMCU and Sonoff POW R2 to which I updated FW. Only one of the Sonoff POW R2 disconnected, all others have been online for the last 24 hours.
I also monitored the entire IoT network traffic, but I did not find anything strange in the relationship with Sonoff POW R2, which lost mqtt connection.

I also monitored the entire IoT network traffic, but I did not find anything strange in the relationship with Sonoff POW R2, which lost mqtt connection.



Re: openhab MQTT connection lost
Try with sending Gratuitous ARP packets (Tools => Advanced, almost at the bottom of the page)
Re: openhab MQTT connection lost
From your comments it seems that you have confirmed the only affected node is the Sonoff POW R2. And maybe just one in particular. Details like this give you a place to concentrate the debugging.
Also, I think it would be useful to log the RSSI so you can review signal strength before and after the MQTT disconnects.
- Thomas
Also, I think it would be useful to log the RSSI so you can review signal strength before and after the MQTT disconnects.
- Thomas
Re: openhab MQTT connection lost
Maybe also try to do a ping to the host that's disconnecting?
Who is online
Users browsing this forum: No registered users and 10 guests