Virtuino Forum
Lost connection to MQTT bruker, reconnect automatically. - Printable Version

+- Virtuino Forum (https://virtuino.com/forum)
+-- Forum: Virtuino (https://virtuino.com/forum/forumdisplay.php?fid=1)
+--- Forum: Virtuino IoT (https://virtuino.com/forum/forumdisplay.php?fid=2)
+--- Thread: Lost connection to MQTT bruker, reconnect automatically. (/showthread.php?tid=1252)

Pages: 1 2


Lost connection to MQTT bruker, reconnect automatically. - SveinHa - 03-31-2023

My Android units running IoT do every now and then (a couple of times pr day) loose connection to my Mosquitto MQTT broker. On Linux Mint it seems far more stable but if I reboot Mosquitto, they all loose connection and have to manually be reconnected.

I did assign a variable to the MQTT Connection Status to show in a Dashboard but the value remains "1" even when the connection is broken (or at least not updating any more).

Any way to automatically reconnect and also have a reliable status indication?


RE: Lost connection to MQTT bruker, reconnect automatically. - iliaslamprou - 04-01-2023

Hi,
After the disconnection the connection status color and the connection status variable are not working.
This is an important issue. 
The app is connected again after some seconds but the user can't see this reconnection.
I will fix this issue on the next update.


RE: Lost connection to MQTT bruker, reconnect automatically. - samxhot - 10-05-2023

Hi,
I have a reconnection problem with the MQTT broker.
I use Node Red as a broker and Virtuino is subscribed in topic e.g "data"
The value display is getting the values from the topic normally but if a re-deploy at node-red(broker) the subscription is no longer active. I do not get any values from the broker.
The connection status is remaining ON, but no incomming data.
If a make an action in a button to connect to the broker, tha virtuino is subscribed again and works normally.
So the automatic reconnection is not working. Is it a bug?


RE: Lost connection to MQTT bruker, reconnect automatically. - SveinHa - 10-05-2023

Same thing in my system. It would be nice to have automatic reconnection and also automatic connection on Virtuino startup.


RE: Lost connection to MQTT bruker, reconnect automatically. - samxhot - 10-06-2023

(10-05-2023, 09:16 PM)SveinHa Wrote: Same thing in my system. It would be nice to have automatic reconnection and also automatic connection on Virtuino startup.

Here I have add that if you restart Virtuino, all connections are established.
Also I checked to publish after a node-red(mqtt broker) re-deploy. It is OK.
Only the subscription to the topic is lost. Not the connection to the broker.
Any ideas?


RE: Lost connection to MQTT bruker, reconnect automatically. - SveinHa - 10-30-2023

(10-06-2023, 05:58 AM)samxhot Wrote: Only the subscription to the topic is lost. Not the connection to the broker.

Same here. Reconnect refreshes the subscriptions.


RE: Lost connection to MQTT bruker, reconnect automatically. - iliaslamprou - 10-30-2023

Hi,
Not sure if this is a bug.

I did some tests and I only have this problem when the parameter "Clean season" is true.
I would like you to do some tests with "Clean season=false"  and update this post.

Ιn case the server disconnects, the application needs some time to realize it. 
If within this time the broker restarts the application does not detect it. 
In this case, I think the problem is in the server side, which loses the list of topics.
I am very interested in fixing this behavior and would like more details.


RE: Lost connection to MQTT bruker, reconnect automatically. - SveinHa - 10-30-2023

(10-30-2023, 10:43 PM)iliaslamprou Wrote: I did some tests and I only have this problem when the parameter "Clean season" is true.
I would like you to do some tests with "Clean season=false"  and update this post.

"Clean session" is unchecked in my application.


RE: Lost connection to MQTT bruker, reconnect automatically. - ervinhaley - 10-31-2023

Are you getting a "preview could not be loaded' error?


RE: Lost connection to MQTT bruker, reconnect automatically. - SveinHa - 10-31-2023

(10-31-2023, 03:16 AM)ervinhaley Wrote: Are you getting a "preview could not be loaded' error?

I haven't seen that error (as far as I remember).