Delay in Rule Execution

Hello,
I’m getting more often a delay in my rule executions and I’m running out of ideas how to troubleshoot.
quickly my scenario: I have Philips HUE Motion Sensors (connected to HUE Bridge and to OpenHAB via HUE Binding), and Homematic actors to turn on/off the lights (homematic actores are connected to homegear via a CUL and homegear to openhab via homematic binding)

Motion events are setting a “presence” item (to give me the info if someone is in the room) and depending on timeslots this triggers to turn on the light. Lights are turned off again via a timer.

This was working actually quite good, but since some days (or perhaps already weeks) I do have a delay. Actually the delay is around 1-2 Seconds, which doesn’T sound long, but if your’re entering a room waiting for the light, 2 seconds are long enough to get angry.

Logs (this is a mix of openhab log and event log)

eventlog: 2020-04-23 10:01:30.994 [vent.ItemStateChangedEvent] - HMS_Motion_WC_Motion changed from OFF to ON

openhablog: 2020-04-23 10:01:32.094 [INFO ] [pse.smarthome.model.script.motion WC] - HMS Motion WC changed to ON - rule beginning
openhablog: 2020-04-23 10:01:32.095 [INFO ] [pse.smarthome.model.script.motion WC] - HMS Motion WC changed to ON - rule end
eventlog: 2020-04-23 10:01:32.096 [ome.event.ItemCommandEvent] - Item ‘pres_WC’ received command ON

the Rules: ()

rule “Presence WC Motion Sensor detected motion”
when
Item HMS_Motion_WC_Motion changed to ON //received updated
then
logInfo(“motion WC”, “HMS Motion WC changed to ON - rule beginning”)
if (pres_WC.state != ON) {
pres_WC.sendCommand(ON)
}

if (timer_wc !== null) {
logInfo(“motion WC”,“motion changed to ON and a timer was running, cancel timer now”)
timer_wc.cancel()
}
timer_wc = null
logInfo(“motion WC”, “HMS Motion WC changed to ON - rule end”)
end

rule “Light WC ON”
when
Item pres_WC changed to ON
then
logInfo(“lights wc”,"Presence state changed ")

if (Licht_WC_State.state == OFF && mce_wc.state == ON) {
logInfo(“lights wc”,“turn homematic WC switch on”)
enabled_via_motion = true
Licht_WC_State.sendCommand(ON)
}
end

I currently phase quite often the issues that when I modify my Item Files the Items do not correctly change their state anymore. This could be somehow related, but in that particular case I do not thing so, since I see the “changed” in the event logs.

UPDATE: this delay is not always happening.

Has anyone any ideas where I can continue my investigations?

  • Platform information:
    • Hardware: x86, 8GB memory
    • OS: ubuntu
    • Java Runtime Environment: OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
    • openHAB version: 2.5.3

thanks
martin

Related recent thread, with workaround

Hello,

thanks for your reply.
I still have such a “keep in memory” rule in some of my rule files, but indeed not in the one mentioned above. I added it now, lets give it a try.

cheers
martin

Remember to change rule “name” if copy-pasting between files, it’s an easy trap to fall in.