MQTT restart and item States


I recently upgraded the MQTT Binding to the newest version 2.4 and everything works great until I change a things file.

I use text file configuration for items and things and when I edit a thing file some items randomly receive command from OH. For example some lights turn on.

It happens also when I restart the Mosquitto service on Linux.

Do you know why OH does that?

Not sure, but when changing configuration files, OH usually triggers a System Started event causing rules to do their thing (pun intended…:grin:). Could it be related to that?

Yes the rules were the culprits. Those items were manipulated in rules but I don’t have any rules that trigger on system started!!
The tests showed that the behavior doesnt show if there are no rules, but persistence fails and several items go to undef.
But when you start openhab those rules don’t trigger and persistence works.
Only when I restart the Mqtt binding or change the files the rules trigger.

I just remember there was/is an issue with MQTT in 2.4 when changing its configuration. Cannot find the issue right now, but I think it was fixed in 2.5.M1.
Or you have to restart OH every time…

Thank you, It was the rules triggering when items went to UNDEF. I corrected the scripts to cope with UNDEF states.
When I edit a thing file in MQTT objects may loose their state even if you have persistence.
But this should suffice for now until 2.5 is official.