EMS-ESP32
EMS-ESP32 copied to clipboard
No automatic MQTT reconnect after software restart in 3.4.2b2
After software restart doesn't start automatic mqtt connection - I must to go to mqtt settings tab, click save, than mqtt connects to my ha server. On previous versions - no problem - only in 3.4.2b2. No hardware changes beetween present and previous version. No errors in log.
This is Ethernet correct? And you can confirm this happens all the time, so from the EMS-ESP web page click on 'Restart' it will not connect to the MQTT server and you'll see these errors in the Console log?
All the time. In console no errors.
No errors on ethernet. The same situation when i'm connected via wifi. This time only ethernet. faster and more stable, and more bandwith :)
I can't reproduce. You will need to compile the code yourself and use the debug flags (see pio_local.ini_example) and watch the MQTT client logs in the serial console.
I installed ha some days ago (next to my ioBroker installation) for test. I observed MQTT problems as well.
My ems-esp system still reboots after a while (some 3 to 5 days in the moment). Last time this night. After this reboot due to software crash ems-esp stays connected to MQTT but no data is send anymore. HA does not show any data anymore. Changing MQTT settings manually off/on will restart MQTT sending data.
When restarting from web-ui everything works fine. I will further observe the MQTT stability ...
Same issue here, MQTT stops working after some time and can only be enabled by switching on/off the MQTT.
@mtc716 anything happen up to this point? i.e. wifi reconnected, MQTT broker restarted etc...
@mtc716 anything happen up to this point? i.e. wifi reconnected, MQTT broker restarted etc...
Nothing at all. It happens just randomly during normal operation. Sometimes after 1 day, sometimes after 2-4 days.
@mtc716 anything happen up to this point? i.e. wifi reconnected, MQTT broker restarted etc...
Nothing at all. It happens just randomly during normal operation. Sometimes after 1 day, sometimes after 2-4 days.
if the MQTT disconnects there should be an INFO log message. Do you see this in the system log? If it happens after a few days its easier to use a SysLog server to capture the logs. In the next build I'll change it to Warning to make it easier to spot.
@mtc716 anything happen up to this point? i.e. wifi reconnected, MQTT broker restarted etc...
Nothing at all. It happens just randomly during normal operation. Sometimes after 1 day, sometimes after 2-4 days.
if the MQTT disconnects there should be an INFO log message. Do you see this in the system log? If it happens after a few days its easier to use a SysLog server to capture the logs. In the next build I'll change it to Warning to make it easier to spot.
Will check for it and I guess it should reoccure latest tomorrow....
@mtc716 anything happen up to this point? i.e. wifi reconnected, MQTT broker restarted etc...
Nothing at all. It happens just randomly during normal operation. Sometimes after 1 day, sometimes after 2-4 days.
if the MQTT disconnects there should be an INFO log message. Do you see this in the system log? If it happens after a few days its easier to use a SysLog server to capture the logs. In the next build I'll change it to Warning to make it easier to spot.
Will check for it and I guess it should reoccure latest tomorrow....
It happened again and just before the disconnect, the WiFi was disconnected according to the logs....
2022-07-20 09:26:38.109 INFO 18305: [emsesp] WiFi connection dropped, stopping NTP 2022-07-20 09:26:38.109 INFO 18306: [system] NTP disconnected 2022-07-20 09:26:38.109 INFO 18307: [emsesp] WiFi disconnected. Reason code=3 2022-07-20 09:26:38.109 INFO 18308: [mqtt] MQTT disconnected: TCP 2022-07-20 09:26:42.975 INFO 18309: [emsesp] Starting NTP 2022-07-20 09:26:42.978 INFO 18310: [emsesp] WiFi connected with IP=192.168.178.36, hostname=ems-esp-new 2022-07-20 09:26:43.019 INFO 18311: [emsesp] mDNS responder service started 2022-07-20 09:26:45.655 INFO 18312: [system] NTP connected
thanks for checking. The reason for the wifi says "WIFI_REASON_AUTH_LEAVE" which doesn't tell us much. Your wifi is down for about 4 minutes. I'll run some tests here again to see if the MQTT reconnects when the wifi is off for a long period.
I can't reproduce. I used connected the EMS-ESP to a Wifi AP, then switched off the AP and back on after a few minutes. As soon as the WiFi reconnected so did MQTT. @mtc716 could you share your MQTT settings in EMS-ESP? Are you using authentication, clean session....
I can't reproduce. I used connected the EMS-ESP to a Wifi AP, then switched off the AP and back on after a few minutes. As soon as the WiFi reconnected so did MQTT. @mtc716 could you share your MQTT settings in EMS-ESP? Are you using authentication, clean session....
I even had it a second time today. Settings for MQTT are below:
Can you try the latest beta? Looks like you're using an older firmware. Not sure it'll make a difference but worth trying. The problem we need to fix is why EMS-ESP loses the WiFi connectivity. The system information we need you can download from the Help page.
The problem occured with the latest Beta 3.4.2b3. I switched today back to 3.4.1 to check If it happens as well...
Do you need the debug information?
ah ok. The emsesp_info.txt file which you can download from the Help page (latest beta) would be useful as it shows the settings and also your WiFi strength (called RSSI). If the WiFi is unstable you can try playing with the settings like using a lower bandwidth or turning on nosleep.
could the instability come from the mqtt broker? Since I installed a new mqtt broker within homeassistant as add in it seem to be stable now and reconnect works
ah ok. The emsesp_info.txt file which you can download from the Help page (latest beta) would be useful as it shows the settings and also your WiFi strength (called RSSI). If the WiFi is unstable you can try playing with the settings like using a lower bandwidth or turning on nosleep.
the file can be found below. As you will see the RSSI is good and by the way, it worked since month at the same location. The difference is just the sw-version. If I can be of any further help, let me know.
could the instability come from the mqtt broker? Since I installed a new mqtt broker within homeassistant as add in it seem to be stable now and reconnect works
I am using already the internal mqtt broker of homeassistant and there has been no change since month.