New MQTT thing breaks stuff

I have a stable MQTT bridge via the internal Mosquitto Server and two dozen devices (running Tasmota or Shelly) connected, all working fine.

I am currently trying to implement this tutorial and have so far flashed and configured the ESP.

Now, as soon as I add it to my things file via:
> Thing topic Turklingel “Turklingel” {

        Channels:
           Type switch : gpio0    "Power Switch"     [ commandTopic ="ESP_Easy_1/gpio/0", on="0", off="1" ]
           Type switch : Turklingel "Switch State"     [ stateTopic = "ESP_Easy_1/Turklingel/State", on="1", off="0"] 
        }

the issues start. According to the log, the bridge and all connected things go OFFLINE, then come back ONLINE - as expected. But they are actually not connected anymore. I can not control them via Openhab and if I switch them manually, the state is not updated in openhab. I can see their state changing in MQTT.fx.

The only fix is to stop openhab, clear the cache and start openhab again. If I do this while deleting the new thing from the file, all works as before. But if I leave the thing in the file, I still can not control any MQTT device and my items file seems to be ignored (e.g. thing names in sitemap, not item names).

Can anyone point me to where to start my troubleshooting?

OpenHAB 2.5.11

Can you show us what the log says when you save the file after adding the new Thing?

Additionally, please show how you connected the new thing to a bridge. The problem might be a failureinthe syntax of the changed file.

Sure!

This is the log after saving the file with the new thing:
https://pastebin.com/4RexFCrg

And this is the full BR_MQTT.things file with the new item in line 23:
https://pastebin.com/bDjdyhed

I don’t see anything obviously wrong.
The log is from ~1 second, what was the change done to the Turklingle thing at the end and what happened afterwards?
Did you set a ( duplicated) MQTT clientID for the Turklingel device?

1 Like

Context:
Working .things file without new item -> I put in the code for the new item and hit save -> log happens -> afterwards nothing happens until I manually perform an action or some other rule triggers anything.
But in regards to the MQTT things, no further action. But in regards to all my MQTT things, there is radio silence.

I just changed the MQTT clientID of the Turklingel ESP but with the same result. Actually, above behaviour occurs whether the Turklingel ESP is online or not…

If these offline-online changings happen with ot without the Turklingel, the cause is somewhere else. A duplicate MQTT clientID could be the cause.

These offline-online changes only happen when I change the MQTT.things file, of course.

What I was meaning to say is that it’s the same outcome whether the ESP is powered or not…

Whenever I change the BR_MQTT.things file, the last log entry is always

2021-01-18 16:42:38.903 [me.event.ThingUpdatedEvent] - Thing 'mqtt:topic:openhab:Turklingel' has been updated.

Even if I only made changes to another item…

Something is weird!
Are you sure the things are defined only by this file and notviaother files or PaperUI?
If such persists I would consider to stop openHAB and clean the cache!

Be aware: there is a pain-in-the-arse bug in openHAB where Things files are not correctly loaded by openHAB after editing and saving them.

Quickest fix is to restart openHAB after every save, but this is tedious so I do this.

What the…
I’ve handled my Things via files for over a year now and never encountered this.

After doing your corruption fix, everything works as planned. Weird indeed…