Replies: 28 comments
-
@proddy : Can I do something to support? |
Beta Was this translation helpful? Give feedback.
-
I'm running the same version but do not recognize this issue. How often does this appear? |
Beta Was this translation helpful? Give feedback.
-
I've been trying for months to reproduce this and can't, very frustrating. @mtc716 if the MQTT or WiFi disconnects you'll see a Warning message in the logs. If it's frequent you may find it in the EMS-ESP logs. Alternatively, run a SysLog server to capture the logs. What I do when debugging is plug a micro-usb into the ESP32, connect it to the PC, change pio_local.ini to enable the Serial port and then see the logs running in on the Serial console via ptty/telnet. |
Beta Was this translation helpful? Give feedback.
-
I've setup remote syslog (ALL) and will watch my gateway for a while also. At the moment it's running fine |
Beta Was this translation helpful? Give feedback.
-
@proddy syslog has been setup and I will be watching for the error. Just for your information, meanwhile I jumped back to 3.4.1. and here I clearly see that when MQTT disconnects it automatically reconnects a couple of seconds later. Which let me conclude that the MQTT broker is working well. |
Beta Was this translation helpful? Give feedback.
-
One thing I directly observed while switching from 3.4.1 to 3.4.2.b4 is that after startup of the system I can see the logs for Wifi starting up, but there is no Startup of MQTT even when its enabled. When I switch if OFF and ON in the WebUI, then its working like expected. Could this be a hint? |
Beta Was this translation helpful? Give feedback.
-
Good spot. I think it's a reporting or timing error, I'll check. Is this in SysLog, console or the web UI? |
Beta Was this translation helpful? Give feedback.
-
No entries in the syslogs, except the starting up of Wifi, NTP, ....etc.. The "expected" entry MQTT connected is just missing. |
Beta Was this translation helpful? Give feedback.
-
I'm not seeing that. Do you have a screenshot? This is what it looks like on my test system: |
Beta Was this translation helpful? Give feedback.
-
On 3.4.1. it looked like the following: 2022-07-25 21:18:38.342 INFO 1809: [mqtt] MQTT disconnected: TCP On 3.4.2.b4 it looks like: Jul 25 21:41:41 ems-esp-new emsesp 000+00:00:00.000 I 1: Starting EMS-ESP version 3.4.2b4 (hostname: ems-esp-new) |
Beta Was this translation helpful? Give feedback.
-
@proddy: I can directly provoke the error. If everything works well and MQTT is enabled and publishes correct values, I just hit the "RESTART" button in the WebUI and the ems-esp restarts and logging as expected, but MQTT is disconnected and stays like it is. What I observed as difference between your screenshot and mine in the logging is the fact that for me, the access point is started and stopped what does not happens for you... ---> I did a quick check and disabled the access point, but no change in behavior. MQTT does not startup for itself for me.... |
Beta Was this translation helpful? Give feedback.
-
@proddy : Might it be that I have somehow a corrupted configuration or setting, which prevents a normal automatic startup of MQTT? |
Beta Was this translation helpful? Give feedback.
-
it's not corruption, I think the EMS-ESP can't connect to the broker. Which MQTT broker are you running and how? We need to turn on its verbose logging to see why the connection is failing. Perhaps an authentication error. It would be handy if you shared your MQTT settings to see if there is a difference. |
Beta Was this translation helpful? Give feedback.
-
I will check for the loggings in the broker. Anyhow, whenever I press SAVE in the MQTT Settings Tab, the connection is immediately made to the broker .... Even no enabling is necessary. Just a save disconnects and reconnects |
Beta Was this translation helpful? Give feedback.
-
so it could be a timing issue. Without the logs its hard to trace. Are you able to compile the source code yourself as there is a DEBUG flag which will show more details on the wifi and mqtt connect status. Then you just need to upload the firmware, plug the ESP32 into a PC using a serial USB and watch the logs.... |
Beta Was this translation helpful? Give feedback.
-
Compiler has been setup and the production release seems to work, but DEBUG env always give me failures with maximum memory: |
Beta Was this translation helpful? Give feedback.
-
no problem. You need to make a copy of the file
this is now your local config for compiling. You can use pio or VS Code to create the build. But before doing this it would be easier if you log the MQTT broker, as I mentioned before. |
Beta Was this translation helpful? Give feedback.
-
Still running fine on my side. Just restarted EMS-ESP32S as @mtc716 suggested to reproduce the issue, no problem there. EMS-ESP still connects to the MQTT broker. I'm using the HA MQTT add-on (version 6.1.2) with a username/password on port 1883 (default) |
Beta Was this translation helpful? Give feedback.
-
Just to keep you informed. The disconnects of Wifi happen due to auto-channel optimizations. The MQTT broker I use is the same like sweetpants. HA addon 6.1.2. with username/pw at port 1883. |
Beta Was this translation helpful? Give feedback.
-
ok, then that's a good use case I can try out as well. I'll mimic a new Wifi SSID and switch the channel and see if EMS-ESP reconnects to the WiFi correctly and also to the MQTT server on your HA environment. It may be just a timing issue as the ESP32s do store wifi details in RAM for fasting connecting by design. Is your HA also on a Wifi network of wired? Which router are you using? |
Beta Was this translation helpful? Give feedback.
-
HA is running on raspberry via wired connection, but the wired connection is just to a Fritzbox 7490 acting as a repeater which is connected via wifi to the router which is a Fritzbox 7590.... |
Beta Was this translation helpful? Give feedback.
-
I meanwhile have got the logging of an event from my broker. It is a debug log. For your information, user "ha_mqtt" is the MQTT connection from HA and user "ems-esp" is the one coming from the ESP connected to the boiler I also added the partial extract of the syslog server monitoring the ems-esp. |
Beta Was this translation helpful? Give feedback.
-
I'll take a look. I wonder if you ran your MQTT server on a fixed network (ethernet or a wifi channel that isn't changing every day) would you still see connectivity issues with EMS-ESP? You do have a very particular setup |
Beta Was this translation helpful? Give feedback.
-
Just my 2 cents. I'm not a cpp guru, but should there not be a "MQTT disconnected" message with a possible reason after WiFi got disconnected? I only see a "MQTT connected" message in the syslog of mtc716. I assume this is after disable/enable MQTT? |
Beta Was this translation helpful? Give feedback.
-
your observation is correct. I missed also the "MQTT disconnected" at any log, by which it could be assumed, that something which has never been disconnected, why should it be automatically re-connected. And the "MQTT connected" rises as you describe it, after disabling/enabling of MQTT. |
Beta Was this translation helpful? Give feedback.
-
There is a MQTT disconnected log message (including the reason), but if your network is down then there is no way to write to the log (syslog, webUI or console), which is why you're not seeing it. |
Beta Was this translation helpful? Give feedback.
-
@proddy : Just to let you that since 3.4.2.b5 no disconnect without an automatic reconnect happened. Which means for me, that the issue is somehow solved or the timing issue is gone. Thanks to you |
Beta Was this translation helpful? Give feedback.
-
that's great, thanks for coming back on this. Fingers crossed indeed! |
Beta Was this translation helpful? Give feedback.
-
I checked the new beta which has been released and I find the same issue.
MQTT disconnects and does not reconnect automatically.
Disabling and enabling of MQTT solves the problem.
In the logs I do not find any hint for a Wifi loss like it has been in 3.4.2b3 or B2. Is it just disabled in the logs?
Beta Was this translation helpful? Give feedback.
All reactions