OpenMQTT Gateway 1.6 MQTT ESP restart not working consistently

Hi,
I have been running OpenMQTTGateway on a couple of ESP32-WROOM-32U boards for a few weeks and I have been experiencing either a unresponsive WebUI with MQTT publishing still working or a complete hang after a few days. I have no practical way of capturing the logs so I thought I would just periodically restart the ESP32 via the MQTT command:

mosquitto_pub -t “home/OpenMQTTGateway/commands/MQTTtoSYS/config” -m ‘{“cmd”:“restart”}’

I can see the command being published but the majority of the time the ESP32 does not appear to respond to restart or status commands via MQTT . Should ESP32 acknowledge the restart or status commands directly?

Hello,

Yes you should see the uptime decreasing with the publication of a new SYStoMQTT message.
Which environment are you running?

I rarely see the uptime reset after the command

I have Home Assistant connected to the same MQTT broker but I’ve just been using CLI mosquitto commands and MQTT.fx to monitor traffic.

BLE, RTL_433, RF ? for example

I am running esp32dev-ble

I’ve noticed that both gateways are resetting after an uptime of less than 2000 typically. freemem = 93680 minfreemem = 31312, freestack = 3132

Here is part of the log file:

N: Found 9 devices, scan number 28 end
N: Send on /SYStoMQTT msg {“uptime”:1803,“version”:“v1.6.0”,“disc
overy”:false,“ohdiscovery”:false,“env”:“esp32dev-ble”,“freemem”:95692,“mqttport”:“1883”,“mqttsecure”:fa
lse,“minfreemem”:30312,“tempc”:48.33333,“freestack”:3132,“rssi”:-50,“SSID”:“XXXXXX”,“BSSID”:“XX:XX:E
B:A0:3E:41”,“ip”:“192.168.1.142”,“mac”:“XX:XX:1B:6C:44:40”,“lowpowermode”:-1,“interval”:55555,“interval
cnct”:3600000,“scnct”:28,“modules”:[“WebUI”,“BT”]}
N: Send on /BTtoMQTT msg {“bleconnect”:true,"interval
":55555,“adaptivescan”:true,“intervalacts”:55555,“intervalcnct”:3600000,“scanduration”:10000,“onlysenso
rs”:false,“randommacs”:false,“hasspresence”:false,“presenceTopic”:“presence/”,“presenceUseBeaconUuid”:f
alse,“minrssi”:-100,“extDecoderEnable”:false,“extDecoderTopic”:“undecoded”,“filterConnectable”:false,“p
ubadvdata”:false,“pubBeaconUuidForTopic”:false,“ignoreWBlist”:false,“presenceawaytimer”:120000,“movingt
imer”:60000,“btqblck”:1,“btqsum”:164,“btqsnd”:124,“btqavg”:1.322581,“bletaskstack”:3028,“blecoretasksta
ck”:3052,“blestarts”:1}
N: Send on /WebUItoMQTT msg {“displayMetric”:true,“webUISecure”:false,“displayQu
eue”:1}
Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x400d94f0 PS : 0x00060830 A0 : 0x800d958a A1 : 0x3ffd2600
A2 : 0x3ffd26a0 A3 : 0x00000002 A4 : 0x0000003a A5 : 0x3ffd26a0
A6 : 0x3ffca10c A7 : 0x00000000 A8 : 0x800d94e8 A9 : 0x3ffd25e0
A10 : 0x3ffd26a0 A11 : 0x0000007b A12 : 0x00000028 A13 : 0x3ffd26c8
A14 : 0x3ffca10c A15 : 0x00000000 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000000e LBEG : 0x40091ccd LEND : 0x40091cdd LCOUNT : 0xffffffff

Backtrace: 0x400d94ed:0x3ffd2600 0x400d9587:0x3ffd2620 0x400e86d6:0x3ffd26f0 0x400e87b3:0x3ffd2ac0 0x40
1d2153:0x3ffd2ae0 0x400ec455:0x3ffd2b00 0x400eaf1a:0x3ffd2b40 0x4011e471:0x3ffd2b80

ELF file SHA256: 758b2010a1c42e2d

Rebooting…
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4
N:
************* WELCOME TO OpenMQTTGateway **************
N: OpenMQTTGateway Version: v1.6.0

I logged it for a few hours and it crashes consistently right after scan 28.

@1technophile any thoughts?

Hello,

Could you try the new development version tomorrow (once the nightly build is done) and see if you get better stability?

Hi Florian,
I will try the new development version when I return from travel in a couple of weeks.

1 Like

@1technophile I loaded v1.7.0 and it throws an exception after scan 28.

Did you erase the flash when uploading?

This was a new ESP32 module and the flash was erased.

Which BLE devices do you use it with ?

Could you try it with bleconnect at false ?

I have a (4) Xiaomi LYWSD03 flashed with pvvx.

I have tried to change bleconnect to false but I do not see the MQTT command changing the config value in the GUI.

mosquitto_pub -t home4/OpenMQTTGateway/commands/MQTTtoBT/config -m ‘{“bleconnect”:false}’

I don’t see a MQTT response after the MQTT command.

Try to add "save":true to the json payload.
Also do you reproduce the issue with different ESP32?

I have had the same exception after scan 28 on 3 different ESP32 modules.

I have bleconnect set to false.

It continued to run past scan 28

@1technophile It threw an exception at scan 198.

N: Send on /BTtoMQTT msg {“bleconnect”:false,“interval”:55555,“adaptivescan”:true,“intervalacts”:55555,“intervalcnct”:3600000,“scanduration”:10000,“onlysensors”:false,“randommacs”:false,“hasspresence”:false,“prestopic”:“presence/”,“presuseuuid”:false,“minrssi”:-100,“extDecoderEnable”:false,“extDecoderTopic”:“undecoded”,“filterConnectable”:false,“pubadvdata”:false,“pubuuid4topic”:false,“ignoreWBlist”:false,“presenceawaytimer”:120000,“movingtimer”:60000,“forcepscn”:false,“tskstck”:2608,“crstck”:3060,“enabled”:true,“scnct”:198}
N: Send on /WebUItoMQTT msg {“displayMetric”:true,“webUISecure”:false,“displayQueue”:0}
Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x400d7f68 PS : 0x00060a30 A0 : 0x800d8002 A1 : 0x3ffd1d60
A2 : 0x3ffd1e00 A3 : 0x00000001 A4 : 0x0000003a A5 : 0x3ffd1e00
A6 : 0x3ffc9598 A7 : 0x00000000 A8 : 0x800d7f60 A9 : 0x3ffd1d40
A10 : 0x3ffd1e00 A11 : 0x0000007b A12 : 0x00000028 A13 : 0x3ffd1e28
A14 : 0x3ffc9598 A15 : 0x00000000 SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000000d LBEG : 0x40091d15 LEND : 0x40091d25 LCOUNT : 0xffffffff

Backtrace: 0x400d7f65:0x3ffd1d60 0x400d7fff:0x3ffd1d80 0x400e9e7e:0x3ffd1e50 0x400e9f6b:0x3ffd2220 0x401d4803:0x3ffd2240 0x400ee47d:0x3ffd2260 0x400ecf32:0x3ffd22a0 0x40120d01:0x3ffd22e0

ELF file SHA256: 8177973ba5cacfec

Rebooting…
ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4

Could you share the version you are using and your parameters ?