MQTT status test

Here we can discuss about the problem found
Post Reply
omega
Posts: 11
Joined: Sun Jul 25, 2021 7:22 pm
Has thanked: 4 times
Been thanked: 2 times

MQTT status test

Post by omega »

Hi,

I am using Annex 1.44 on Wemos D1 module. I am working on heating controller where data from temperature sensors are sent to MQTT server, then stored to influxdb via NodeRed and visualized in Grafana.

I need to ensure that controller will be controlling heating boiler 24/7 even if WiFi is down or MQTT server would disconnect (for any reason). Note: MQTT and other servers are running on Orange PI.

What I do in the beginning of my script is to connect to WIFI (if connected, then it skips this step) and then I connect to my mqtt server. Connection checks are done afterwards regularly using timer1, every 5 minutes. WIFI.STATUS, MQTT.CONNECTED.

My issue is that if MQTT server is not connected, then MQTT.CONNECTED throws exception and ESP reboots. The same happens with MQTT.STATUS.

I tried:
- connect to MQTT server every time before MQTT.PUBLISH
- MQTT.DISCONNECT and MQTT.SETUP, CONNECT, SUBSCRIBE before MQTT PUBLISH

instantly or later it crashes into reboot. Even typing WLOG MQTT.STATUS into immediate windows reboots the device.

Any help / advice?
User avatar
cicciocb
Site Admin
Posts: 2069
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 441 times
Been thanked: 1363 times
Contact:

Re: MQTT status test

Post by cicciocb »

You are right, I confirm the problem.
I'll give a deeper look into it
omega
Posts: 11
Joined: Sun Jul 25, 2021 7:22 pm
Has thanked: 4 times
Been thanked: 2 times

Re: MQTT status test

Post by omega »

Hello cicciocb,
Could you please give an update if the MQTT issue has been fixed (specifically on 8266 version)?
Thanks! Jan
User avatar
cicciocb
Site Admin
Posts: 2069
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 441 times
Been thanked: 1363 times
Contact:

Re: MQTT status test

Post by cicciocb »

Hi,
have you already tried with the latest releases of Annex and Annex32 ?
omega
Posts: 11
Joined: Sun Jul 25, 2021 7:22 pm
Has thanked: 4 times
Been thanked: 2 times

Re: MQTT status test

Post by omega »

Hi, thanks for a quick response. I asked since I haven't seen this fix mentioned in the change log.
I updated my device with Annex to 1.47 (BTW, it still shows 1.44.2). So far it looks good.
Thank you.
smurfy
Posts: 2
Joined: Sat Feb 18, 2023 9:35 am

Re: MQTT status test

Post by smurfy »

Hi, am I the only one who still has problems with ESP8266 crashing at mqtt.connect? It's like this since SW versions above 1.43.
these are the lines:
wlog mqtt.setup ("test.mosquitto.org")
'wlog mqtt.status()
wlog mqtt.connect("", "")

It's crashing either at .status or .connect. setup returns a 1.
no problems whatsoever with ESp32.

Thanks
User avatar
cicciocb
Site Admin
Posts: 2069
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 441 times
Been thanked: 1363 times
Contact:

Re: MQTT status test

Post by cicciocb »

Hi
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri May 10, 2024 7:00 pm Hi, am I the only one who still has problems with ESP8266 crashing at mqtt.connect? It's like this since SW versions above 1.43.
these are the lines:
wlog mqtt.setup ("test.mosquitto.org")
'wlog mqtt.status()
wlog mqtt.connect("", "")

It's crashing either at .status or .connect. setup returns a 1.
no problems whatsoever with ESp32.

Thanks
Hi,
you are specifying a wrong url (the protocol is missing).
The right syntax is

Code: [Local Link Removed for Guests]

wlog mqtt.setup ("mqtt://test.mosquitto.org")
wlog mqtt.status()
wlog mqtt.connect("", "")
This is an extract from the help file :
image.png
You do not have the required permissions to view the files attached to this post.
smurfy
Posts: 2
Joined: Sat Feb 18, 2023 9:35 am

Re: MQTT status test

Post by smurfy »

Ahh thanks, that was a case of "didn't see the forest for the trees". :oops:
I was looking for a return value of 1 but should be 0 even when I wrote the correct syntax. And the crashing made me believe something else is wrong.

But the LWT is still not included with ESP8266 right?
User avatar
cicciocb
Site Admin
Posts: 2069
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 441 times
Been thanked: 1363 times
Contact:

Re: MQTT status test

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sat May 11, 2024 8:53 pm Ahh thanks, that was a case of "didn't see the forest for the trees". :oops:
I was looking for a return value of 1 but should be 0 even when I wrote the correct syntax. And the crashing made me believe something else is wrong.

But the LWT is still not included with ESP8266 right?
Yes, the LWT is not included for the ESP8266
Post Reply