MQTT Configuration example please

Package:
Openhabian from https://github.com/openhab/openhabian/releases/tag/v1.4.1

Platform:
###############################################################################
###############  HA_Broker2  ##################################################
###############################################################################
##        Ip = 192.168.0.252
##   Release = Raspbian GNU/Linux 9 (stretch)
##    Kernel = Linux 4.19.42-v7+
##  Platform = Raspberry Pi 2 Model B Rev 1.1
##    Uptime = 0 day(s). 0:10:31
## CPU Usage = 16.46% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.31, 5m: 0.60, 15m: 0.48
##    Memory = Free: 0.30GB (32%), Used: 0.64GB (68%), Total: 0.95GB
##      Swap = Free: 0.09GB (100%), Used: 0.00GB (0%), Total: 0.09GB
##      Root = Free: 214.38GB (98%), Used: 2.18GB (2%), Total: 228.22GB
##   Updates = 0 apt updates available.
##  Sessions = 2 session(s)
## Processes = 111 running processes of 32768 maximum processes
###############################################################################

Java version:
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (Zulu8.38.0.163-CA-linux_aarch32hf) (build 1.8.0_212-b163)
OpenJDK Client VM (Zulu8.38.0.163-CA-linux_aarch32hf) (build 25.212-b163, mixed mode, Evaluation)

After installation of openhabian on my Raspberry (which is by the way great solving a lot of configuration efforts), my goal is to activate the OH2 MQTT binding to configure my Home automation system that is currently running on OH1 (successfully since years).

The challenge: To start a fresh new installation trying to understand the OH2 (not just to port the OH1 configuration).

My configuration is rather simple I use only Mosquitto /MQTT.

Without a nice example I do blindly things, that I don’t really understand …

I couldn’t find any nice example in the documentation, so I’ started with one of the WEB:

With to start at least 2 issues:

  1. With my Firefox Browser the MQTT Binding (Add-on + BINDINGS)installation is working indefinitely (spinning wheel of death). However Installation looks to be OK if I refresh the page.
  2. Looking at services I have no MQTT Configuration file
    ls $OPENHAB_CONF/services
    addons.cfg classicui.cfg logging.cfg rrd4j.cfg
    basicui.cfg dashboard.cfg readme.txt runtime.cfg

What I did is from Paper UI:

  1. From Add-ons >Bindings> MQTT Broker install … Waiting a long time to be sure
  2. From Inbox Add-manually MQTT Broker
    Configuration parameters
    • Name: HA_MQTT_Broker2
    • Location: Home
    • Thing ID: HA_MQTT_2
    • Broker address: 127.0.0.1
    • Client ID: HA_MQTT_2
    • No Secure Connection
    • Broker Port : 1883
    • Client ID: HA_MQTT_2_Client
    • Qos: At least once (1)
    • No retain messages
    • Reconnect time and Heartbeat: default 60000
    • No last will message and topic
    • Last will Qos: At least once (1)
    • Password: MQTT
    • User: MQTT
    • No Certificate pinning
    • No Public key pinning
    • No certificate mash
      And I have MQTT Broker ONLINE
  3. From Inbox>Choose Binging
    MQTT Binding
    Add Manually > Generic MQTT Thing
    • Name: HA_Broker2_Generic_Things
    • … Thing ID> e0f9a6e1
    • Location: Home
    • Bridge Selection:HA_Broker2_MQTT-mqttbroker:6454ab6d

I have now in Configuration > Things
T HA_Broker2_Generic_Things ONLINE
B HA_Broker2_MQTT ONLINE
Nice isn’it … but what next …

So the first questions:

  1. Before going further with site map, items etc. , I would like to be sure this is the correct way to follow
  2. Why don’t see I with this configuration configuration bindings templates (or where are they for MQTT for instance)
  3. Next before configuring my motes to send MQTT messages to the OH broker I would like to test to publish messages from for instance MQTT.fx (note that the MQTT client pub / sub client on the Raspberry broker is working fine).

So to be continued after I expect some answers

Thanks in advance Robert

I could go on.

2 Likes

Most of the explanations refers to the mqtt.cfg file
Where is this file (certainly not under $OPENHAB_CONF/services in my case)
Robert

None of the links I provide above should refer to a mqtt.cfg. That file is for the MQTT 1.x version of the binding and all of the links above are for the 2.x version of the binding. In the 2.x version of the binding everything gets configured in the Things.

Thanks

Of course you could also define your mqtt bridge and things in a *.things file :slight_smile: At least one of @rlkoshak’s links contains some code example for that task.