I have OH2 (build 642) running under Windows. Work like a charm.
Now i decided to buy some Sonoff devices, so i flashed those, configured them to use MQTT.
Then i installed mosquitto on the same server as OpenHab.
Also works. When i test with: mosquitto_sub.exe -t /home/stue/switch1/POWER i receive messages from the Sonoff device. So my MQTT server works.
But when setting up OpenHab2 as a client, the frustration starts.
The error i see is:
[ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost
Connection lost (32109) - java.io.EOFException
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:138)[197:org
.openhab.io.transport.mqtt:1.9.0.201612130210]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:267)[:1.8.0_111]
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInpu
tStream.java:56)[197:org.openhab.io.transport.mqtt:1.9.0.201612130210]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:100)[197:org
.openhab.io.transport.mqtt:1.9.0.201612130210]
... 1 more
I keep getting information in the log about broker connection started with previous used brokers (i renamed it a few times in MQTT.CFG):
[INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘mqtt’
[INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘oh2’
[INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mqtt1
and so on…
I see alot of:
[ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost
In MMQTT.CFG i have:
oh2.url=tcp://localhost:1883
oh2.clientId=oh2client
oh2.retain=true
mqtt.items i have:
Switch MQTTtestitem “MQTTtestitem”
{ mqtt=">[oh2:/home/stue/switch1/RESULT/POWER:command:*:default],
<[oh2:/home/stue/switch1/RESULT/POWER:state:default]" }
In sitemap i have:
Switch item=MQTTtestitem
Any help would be highly appreciated.