MQTT broker connection lost, every 2 minutes?

Gday,

Well I have managed to set up a Mysensors MQTT gateway which I was quite pleased with and have a simple PIR sensor connected too it and it works!

When I look to openHAB I noticed that every 2 minutes (almost exactly) the broker connection was lost.
Is there are setting or reason this would occur? (MQTTlens seems to stay connected ok)

2016-02-06 **23:31:36.661** [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to broker was lost
org.eclipse.paho.client.mqttv3.MqttException: Unexpected error
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:115) ~[na:na]
        at java.lang.Thread.run(Unknown Source) [na:1.8.0_71]
2016-02-06 23:31:41.403 [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to 'mysensors' was lost: Unexpected error : ReasonCode 6 : Cause : Unknown
2016-02-06 23:31:41.403 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'mysensors'
2016-02-06 23:31:51.419 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting MQTT broker connection 'mysensors'

2016-02-06 **23:33:36.663** [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to broker was lost
org.eclipse.paho.client.mqttv3.MqttException: Unexpected error
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:115) ~[na:na]
        at java.lang.Thread.run(Unknown Source) [na:1.8.0_71]
2016-02-06 23:33:42.785 [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to 'mysensors' was lost: Unexpected error : ReasonCode 6 : Cause : Unknown
2016-02-06 23:33:42.786 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'mysensors'
2016-02-06 23:33:52.787 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting MQTT broker connection 'mysensors'

2016-02-06 **23:35:36.661** [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to broker was lost
org.eclipse.paho.client.mqttv3.MqttException: Unexpected error
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:115) ~[na:na]
        at java.lang.Thread.run(Unknown Source) [na:1.8.0_71]
2016-02-06 23:35:40.080 [ERROR] [o.i.t.m.i.MqttBrokerConnection] - MQTT connection to 'mysensors' was lost: Unexpected error : ReasonCode 6 : Cause : Unknown
2016-02-06 23:35:40.080 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'mysensors'
2016-02-06 23:35:50.082 [INFO ] [o.i.t.m.i.MqttBrokerConnection] - Starting MQTT broker connection 'mysensors'

I cant seem to get the item to display its state on the sitemap,
I have the item set up as a switch with a simple map and can see its state coming in on the logs,
Switch mysPIR1 "mysPIR" {mqtt="<[mysensors:MyMQTT/20/1/V_TRIPPED:state:MAP(1on0off.map)]"}

2016-02-06 23:45:03.535 [INFO ] [runtime.busevents ] - mysPIR1 state updated to OFF
2016-02-06 23:45:09.666 [INFO ] [runtime.busevents ] - mysPIR1 state updated to ON

On the sitemap I have this, but it just doesn’t show the switch changing state.
Text item=mysPIR label="myPIR [MAP(1on0off.map):%s]" icon="info"

Could someone point me in the right direction with this?

Regards,
George

Ok I have got the item displaying on the sitemap with the following.

Item:
Number mysPIR1 "mysPIR1" {mqtt="<[mysensors:MyMQTT/20/1/V_TRIPPED:state:default]"}

Sitemap:
Text item=mysPIR1 label="myPIR [MAP(1on0off.map):%s]" icon="info"

Transform: 1on0off.map
0=OFF
1=ON
-=unknown

I am still stumped on why the MQTT broker connection is being lost every 2 minutes. Any ideas here would be greatly appreciated.

Regards,
George

I have also mysensors and i am also experiencing problems with the MQTT gateway. The serial gateway with a .rules seems to work stable. But i would like to use MQTT.

Maybe the problem is that the MQTT-server running on your arduinno can only keep a connection to one client. It is a low powered cpu. So have you tried to Not monitor your mysensors MQTT with other clients and only have openhab connect to it ?

Or have you solved this since this is already a 3 months old.

Regards,
Pieter

Yes you are right that the mysensors MQTT gateway does seem to have problems with more than one client.

Simply fixed by not using MQTTlens as well as the openhab connection.
Took me a little time to figure it out but all working well now.

Cheers,
George