Just in case someone experiences the same:
When I add a mqtt-thing (I do this via .things file), the mqtt-binding receives updates from this device as expected, but only from that new device. Any other defined mqtt-things stop receiving updates.
The solution here is to temporarily disable and re-enable the mqtt-bridge-thing (The thing that connects openhab to your mqtt-broker) in PaperUI. After that all mqtt-devices are updated in openhab. So not a big deal, but worth noting.
I’m currently running 2.5.10, but the same but existed in 2.5.9.
Have you tried adding a new “thing” to your things file and see what happens?
I’ve only had that on this occasion, on a restart of the mqtt-broker-thing everything works again.
I might be wrong, but can it be related to the way the bridge is defined/used?
Could you try to define the MQTT bridge/thing from PaperUI or in a text file (.things) like in the below example (adjust the parameters to match your environment):
Hmm, I have one file with all the mqtt-things in it, which is why I only need to define the bridge once and do not need to reference it again (or defining multiple bridges). But I fail to see the real difference here.
That’s also the reason I did it in files (instead of PaperUI) as I have several identical devices and in a file can easily copy text and create multiple things. I think openhab3 offers that in the GUI…
That’s fine, just be sure to nest all a Bridge’s children in curly braces { }
You’re on something of a goose-chase here; it is not unexpected that many OH2 bindings do not play nicely with Things & channels editing in files. It’s very common to find that edits are not correctly picked up until the binding is reinitialized. That’s always been the case, some bindings are better at it than others, some have been improved over time.
I think you have discovered that for MQTT sometimes you only need reinitialize the broker Thing, which sounds useful. Makes sense, it will resubscribe everything.
Configuring Things and channels via GUI fares better in this regard, somewhere behind the scenes it pushes different buttons.
You may be right there. Maybe I’m just more of an old-school console guy.
But yes, OH is now such a complex structure that some incompatibilities are to be expected. Interestingly enough, after every update of OH I always need to restart the service twice for it to run well, first time around always gives me lots of errors on the console.
This post was not to complain about the glitches, but more to give someone else a hint who might run into the same issue (which in this case is easily fixed).
Got exact same issue here.
Spent 2 days migrating hundreds (241) of items across to mqtt2.5 binding
have around 7 thing files like such;
Bridge mqtt:broker:blindsBroker [ host="mqtt.home", secure=false, port=1883]
{
Thing topic FrontRoomRight
{
Channels:
Type number : Position "Position" [stateTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/position", commandTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/position/set"]
Type number : Battery "Battery" [stateTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/battery"]
Type datetime : LastUpdate "Last Update" [stateTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/time"]
Type string : Move "Move" [commandTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/move/set"]
Type switch : MoveUp "Move Up" [commandTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/moveup/set"]
Type switch : MoveDown "Move Down" [commandTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/movedown/set"]
Type contact : Working "Working" [stateTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/working"]
Type switch : Refresh "Refresh" [commandTopic = "home/blinds/rpiserver01/f4:21:18:4c:58:1b/refresh/set"]
}
Thing topic FrontRoomLeft
{
Channels:
Type number : Position "Position" [stateTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/position", commandTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/position/set"]
Type number : Battery "Battery" [stateTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/battery"]
Type datetime : LastUpdate "Last Update" [stateTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/time"]
Type string : Move "Move" [commandTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/move/set"]
Type switch : MoveUp "Move Up" [commandTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/moveup/set"]
Type switch : MoveDown "Move Down" [commandTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/movedown/set"]
Type contact : Working "Working" [stateTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/working"]
Type switch : Refresh "Refresh" [commandTopic = "home/blinds/rpiserver01/fd:9b:70:91:33:ba/refresh/set"]
}
...snipped
}
They stop working randomly and the other solution is to either touch the file (rare that it works) or rename the broker or the faulty channel and then name it back again.
Updating the topic also has more misses that hits. log set to trace and you can see it saying successfully published message to new topic but using mqtt spy, the message never arrives. Rename and back again and the message arrives.
There certainly seems to be something wrong with the binding with this. The 1.x binding never missed a beat (same mqtt instance in a container on rpi)
I would agree that there’s some other cause to this. Are you using zigbee2mqtt, by any chance? That occasionally dies on me, rarely, but it does. Even though I only have like a dozen zigbee devices in total.
To monitor that I log and track the link quality. That fluctuates rather frequently, especially with mains-powered devices. When those lines start flatlining, I know that zigbee is down.