I’m having a strange issue with one of my openHAB automations. The motion sensor works normally, but after restarting openHAB, the rule sometimes stops triggering until I manually reload things.Has anyone experienced something similar? Is there a recommended way to make sure rules and sensor events initialize properly after a restart?
binding isnt ONLINE yet when the rule engine starts, so the item sits on UNDEF and never “changes” to ON. reloading things just kicks the handler.
in events.log after a restart look for the Thing going from UNINITIALIZED / HANDLER_MISSING_ERROR to ONLINE. if the rule is changed to ON it will miss the first real motion until that happens.
add a System started rule that waits until the motion item is not UNDEF, or put restoreOnStartup on that item. also make sure the binding is a startlevel dependency so rules dont run at 80 while the thing is still 70.
if its zwave/zigbee the stick is slow after boot, delay 30-60s then things refresh is what youre already doing by hand.
Thanks, that makes sense. I hadn’t considered that the binding might still be initializing when the rule engine starts. I’ll check the events.log after the next restart and see whether the motion item is still UNDEF or whether the Thing is coming ONLINE afterward.
I’ll also look into adding a startup delay/check so the rule doesn’t depend on the sensor being ready immediately after boot. The start-level dependency suggestion is helpful too. Thanks for pointing me in the right direction!