Channels in MQTT Broker not loading after openHAB restart

  • Platform information:

    • Hardware: Raspberry Pi 4 Model B Rev 1.2 (4GB RAM); SDD WDC_WDS500G1R0B-68A4Z0
    • OS: Raspbian GNU/Linux 10 (buster)
    • Java Runtime Environment: openjdk version “11.0.11” 2021-04-20 LTS
    • openHAB version: openHAB 2.5.12 Release Build
    • mosquitto version: 1.5.7
  • Issue of the topic:
    Channels of type publishTrigger are not loaded for my MQTT Broker after restart of openHAB2. I have to randomly edit and save the .things file until the channels are recognized properly.

//Thing File:
Bridge mqtt:broker:MQTT_Bridge "MQTT Bridge" @ "MQTT" [host="localhost", port=1883, secure="AUTO", username="USERNAME", password="PASSWORD", enableDiscovery=false] 
        Type publishTrigger : MQTT_Broker_ESP32_ESPresense_Auto1_publishTrigger "MQTT ESP32 ESPresense Auto 1 Publish Trigger" [stateTopic="espresense/devices/7c2f80c45e99/#", separator="#"]

Here is an example of the logfile when the channel is regonized properly and triggers. Everything is fine:

//Logfile OK:
2022-12-02 12:28:07.570 [vent.ChannelTriggeredEvent] - mqtt:broker:MQTT_Bridge:MQTT_Broker_ESP32_ESPresense_Auto1_publishTrigger triggered espresense/devices/7c2f80c45e99/garage#{"id":"7c2f80c45e99","idType":55,"rssi@1m":-71,"rssi":-75,"raw":1.30,"distance":1.24,"speed":0.00,"mac":"7c2f80c45e99","interval":3101}

This is my mqtt.cfg file (if important):


This is the response when I check the REST API of my MQTT Broker with the successfully loaded channel:

	"statusInfo": {
		"status": "ONLINE",
		"statusDetail": "NONE"
	"editable": false,
	"label": "MQTT Bridge",
	"configuration": {
		"lwtQos": 0,
		"publickeypin": true,
		"keepAlive": 60,
		"clientid": "b6bed02a-477c-4eca-ac76-4682e313d912",
		"secure": "AUTO",
		"certificatepin": true,
		"password": "PASSWORD",
		"qos": 0,
		"reconnectTime": 60000,
		"port": 1883,
		"host": "localhost",
		"lwtRetain": true,
		"username": "USERNAME",
		"enableDiscovery": false
	"properties": {},
	"UID": "mqtt:broker:MQTT_Bridge",
	"thingTypeUID": "mqtt:broker",
	"channels": [
			"linkedItems": [],
			"uid": "mqtt:broker:MQTT_Bridge:MQTT_Broker_ESP32_ESPresense_Auto1_publishTrigger",
			"id": "MQTT_Broker_ESP32_ESPresense_Auto1_publishTrigger",
			"channelTypeUID": "mqtt:publishTrigger",
			"kind": "TRIGGER",
			"label": "MQTT ESP32 ESPresense Auto 1 Publish Trigger",
			"defaultTags": [],
			"properties": {},
			"configuration": {
				"stateTopic": "espresense/devices/7c2f80c45e99/#",
				"separator": "#"
	"location": "MQTT"

This morning I had to restart openHAB2 and unfortunately as expected, the publishTrigger channel is not loaded again. The mosquitto MQTT broker definately receives the expected trigger messages:

mosquitto_sub -h localhost -d -v -t "#"

Client mosqsub|12176-RasPiHome received PUBLISH (d0, q0, r0, m0, 'Client mosqsub|12176-RasPiHome received PUBLISH (d0, q0, r0, m0, 'espresense/devices/7c2f80c45e99/garage', ... (136 bytes))
espresense/devices/7c2f80c45e99/garage {"id":"7c2f80c45e99","idType":55,"rssi@1m":-71,"rssi":-70,"raw":0.94,"distance":1.17,"speed":-0.01,"mac":"7c2f80c45e99","interval":2865}

The PaperUI is also empty:

I tried the following:

  • Add the channel via PaperUI (of course not possible because I use 100% text files)
  • Disabled/Enabled my MQTT Broker Thing via PaperUI without success
  • Restarted the MQTT Binding via openhab-cli Karaf console without sucess (my ID256)
  • Restarted the MQTT Transport feature via openhab-cli Karaf console without sucess (my ID 260)
  • Randomly edit/save my mqtt_broker.things file, sometimes it loads the channel properly so I know it is working in general.

Any Idea how to solve this? Is it possible to add another (second) MQTT Broker to openHAB2 which refers to the same mosquitto broker on my instance?

Overall I want to achieve the approach from the ESPresense post from this thread which is not realy reliable with this behavior. I dont have any other issues with my 35 MQTT things which refer to this broker.

You are using an fairly obscure feature of an obsolete binding. It may well be buggy, but its not going to get fixed.

Why use the trigger channel, why not a regular channel under a topic type Thing? You could set the postCommand option to have incoming messages generate an openHAB event, but it would be an Item command and not a trigger channel.

This is not used by the Things and channels MQTT v2 binding.
You’re not running the v1 binding alongside are you?

This is possible. I’m not sure what you think it would gain for you.
You need to take care that each connection identifies itself to the broker with a different client ID. I don’t think you can rely on auto-generated ID because they’d be alike (this applies to v1 too I think)