- Platform information:
- Hardware: RaspberryPI 3 Model B+
- OS: Openhabian
- openHAB version: Latest
A big hello to the community!
I am a newbie with openHAB so please excuse any silly questions. I have successfully setup openhabian on my Raspberry Pi 3 B+ having also installed Mosquitto as my MQTT broker. Now, I have read the begginers guides and cannot for the life of me find the resolution to my problem.
I’ve managed to flash my Sonoff basic with Tasmota and can subscribe to the topic ‘garageDoor’ via ssh terminal:
mosquitto_sub -h localhost -t "+/garageDoor/#" -v
and recieve the following everytime I press the Sonoff button manually:
tele/garageDoor/LWT Online
cmnd/garageDoor/POWER (null)
stat/garageDoor/RESULT {"POWER":"ON"}
stat/garageDoor/POWER ON
stat/garageDoor/RESULT {"POWER":"OFF"}
In addition i can also manually switch on and off using:
mosquitto_pub -h localhost -t "cmnd/garageDoor/POWER" -m ON
mosquitto_pub -h localhost -t "cmnd/garageDoor/POWER" -m OFF
However, no matter what I do I cannot get the button to operate this in the UI.
Please see my setup for all files:
home.items:
//GarageDoor
Switch GarageDoor "Garage Door" <rollershutter> { mqtt=">[mqttoh:cmnd/garageDoor/POWER:command:*:default], <[mqttoh:stat/garageDoor/POWER:state:default]" }
home.sitemap:
sitemap home label="Home" {
Frame label="Garage" {
Switch item=GarageDoor
}
}
mqqt.cfg:
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with an ID you choose.
#
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mqttoh.url=tcp://192.168.0.10:1883
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
mqttoh.clientId=openhabianMQTT
# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false
# Optional. User id to authenticate with the broker.
mqttoh.user=openhabian
# Optional. Password to authenticate with the broker.
mqttoh.pwd=openhabian
# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>
The above clientID and username/password are set in the MQQT section on Tasmota.
I have noticed mqqt connection is lost in the tail:
2018-08-19 14:08:36.680 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to 'mqttoh' was lost: Connection lost : ReasonCode 32109 : Cause : null
2018-08-19 14:08:36.685 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'mqttoh'
2018-08-19 14:08:46.694 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mqttoh'
2018-08-19 14:08:47.755 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost
org.eclipse.paho.client.mqttv3.MqttException: Connection lost
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146) [226:org.openhab.io.transport.mqtt:1.12.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:267) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107) ~[?:?]
... 1 more
Any help would be greatly appreciated!
Many thanks in advanced
Jeevs