If you have the mosquitto broker running in another pi, you don’t need to install mosquitto on the openhabian pi too.
Install the mqtt binding in the paperUI
This will create a file called mqtt.cfg located in the config/services folder
Edit this file to include the details of your already running broker and OH will connect to that broker
See:
and:
By the way, I use this set-up too, I have a mosquitto broker running alone on a pi-zero. That’s all it is running. And OH is running on a recycled HP thin client.
#
# 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
redpi_mqtt_broker.url=tcp://192.168.53.105:1883
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=<clientId>
# 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.
redpi_mqtt_broker.user=mquser
# Optional. Password to authenticate with the broker.
redpi_mqtt_broker.pwd=secret
# 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>
# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#<broker>.retain=<retain>
# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>
# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>
cat /etc/openhab2/items/sensors.items results in:
Number mqtt_pressure “Tank Pressure [%.1f]” {mqtt="<[redpi_mqtt_broker:dev/test:state:default]"}
In paperui I see an Item call Tank Pressure, in Add-ons the the MQTT binding shows as installed (but does not show up in Bindings), in HABpanel I added a button and it only updates the value when the Run button of the edit dashboard is clicked. BUt doesn’t update after that.