Script with Blocky: reschedule block triggers only once

I created a rule to turn on a light when motion is detected and turn off when no motion detected for 3 minutes.
The rule is triggered by the motion sensor changing to ON:

the issue is that when the “else if” condition is met for the first time the timer is rescheduled, but the second time it’s not.
Is this a “feature” of the reschedule block or there is an issue?
thanks

Errors in the log?

Add some logging blocks to see what the states of those two items are every time the timer block runs. Are you sure the else if it’s running?

Hi Rich,

the behavior I experience is the following:
If I stay in the room for less than 5 minutes (I tested 4.5 minutes) and the I exit, the light turns off.
If I stay in the room for more than 5 minutes and then exit, the light never turns off.
Consider also that the motion sensor has a 60 seconds “cooldown” after being triggered, and if motion is detected when it’s already ON, there is no change in the item state.

I will add some logging blocks to try to pinpoint the issue and post them here.

I modified the script as follows:

the relevant logs:

2021-11-25 18:53:12.398 [INFO ] [org.openhab.rule.b7323e80df         ] - timer start
2021-11-25 18:56:12.413 [INFO ] [org.openhab.rule.b7323e80df         ] - Timer finished
2021-11-25 18:56:12.527 [INFO ] [org.openhab.rule.b7323e80df         ] - Else if condition met > reschedule
2021-11-25 18:59:12.502 [INFO ] [org.openhab.rule.b7323e80df         ] - Timer finished
2021-11-25 18:59:12.551 [INFO ] [org.openhab.rule.b7323e80df         ] - Else if condition met > reschedule

After these nothing else is logged and the light is still on.

To me it seems that the reschedule block works only once, but I’m open to better ideas :slight_smile:

IT does look like it should be rescheduling. My recommendation is to file an issue on the openhab-webui repo where more information will be requested and further trouble shooting steps can be taken.

Hi Rich,

I opened an issue here:

hope it’s the right place