Items go crazy during startup

Hi,
I am still on OH1 (no time to migrate).
I had all my rollershutters, lamps etc. connected via the serial binding which was quite complicate to maintain, finally I was able to transform it to MQTT.
This is when the trouble started. Since then, every time I restart OH, they go crazy. Lights turn off, shutters go down or up and I am wondering what causes this.
I don’t have rules which trigger during startup (except a few initializations).
Persistance is via mySQL, but only items which are relevant are restored during startup, no physical items.

The configuration of MQTT has following:
mqtt:mosquitto.qos=0
mqtt:mosquitto.retain=false
mqtt:mosquitto.async=false

Any ideas what to change?

Thank you!
SJ

First look in events.log and see if OH is seeing these commands itself or if this is all happening outside of OH.

If OH is seeing the commands then we need to look at your Item definitions.

1 Like

What’s actually controlling the devices?

I had a similar problem which I never got to the bottom of using ESP8266s. When wifi was lost and regained (or openHAB was restarted) it looked like the last few MQTT messages previously sent were resent and acted upon.

Anyway, I never worked out what it was that had caused it. In the end, I added a bit of code to the ESP8255 sketch that added a twenty second delay after any sort of reset or loss of communication before any MQTT messages were dealt with. This meant that those first few spurious MQTT commands were ignored.

I didn’t do any more as I decided, because of the unreliability of wi-fi, to control any devices which required incoming messages with ethernet or direct wiring only.
I plan to use only wifi for data collection.

Not much help to you though.

Thank you for your help. I just found out what caused the problem. Acutally I think it was not caused by MQTT. Maybe MQTT works better that’s why I noted that only after the change.

The root case are rules for a Homematic device. I do have a 6 button swich (HM-PB-6-WM55) and on all buttons, I do have several routines (e.g. on one turn off all lights, on another all shutters up, also one for half way down, all down…)

Those rules are of course defined like “Item HM_Scene_Key_xx changed” and surprisingly when OH is restarted, it loads all HM data points and therefore changes them. Which basically results in “pressing all keys” and executing my rules.

And then the “magic” begins… :slight_smile:

I do not know why this hasn’t happend before, but maybe MQTT makes sure that all messages are getting delivered (QoS) and serial did just output them and maybe it wasn’t ready at this point during startup or to slow for all those requests.

Sorry bothering you. This caused quite a few hours of research, testing and frustration (wife).

Cheers,
SJ

some are ESP, some are MySensors devices. Most of the stuff is acutally pretty reliable especially the ESP ones do not cause any issues since quite some time.
Anyhow issue solved, see above. Thanks for taking the time though!

I’ve been there. I had set the “retain” flag in OH with a QOS 2 for MQTT and couldn’t figure out why my garage doors went up every time the RPi that is wired to them reboots. Sounds like you found your problem a lot faster than it took me to find mine. :slight_smile: I had to disable the controller for months before I tracked that problem down.

For future readers: DO NOT USE “retain” FOR ACTUATORS. :slight_smile:

1 Like

I’ve just checked and my retain flag was set to true.

Maybe I ought to revisit my problems!