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
rlkoshak
(Rich Koshak)
November 25, 2021, 2:59pm
#2
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
rlkoshak
(Rich Koshak)
November 27, 2021, 3:59pm
#5
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:
opened 08:58AM - 28 Nov 21 UTC
bug
main ui
## The problem
when using the "reschedule" block in a rule (script), the fir… st time the rule is triggered the timer is properly rescheduled, but the second time it’s not.
## Expected behavior
every time that the rule is triggered, it should reschedule the timer
## Steps to reproduce
Example:
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 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.
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
## Your environment
runtimeInfo:
version: 3.2.0.M4
buildString: Milestone Build
locale: en-IT
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 11.0.13
javaVendor: Azul Systems, Inc.
javaVendorVersion: Zulu11.52+13-CA
osName: Linux
osVersion: 5.10.63-v7+
osArchitecture: arm
availableProcessors: 4
freeMemory: 73255232
totalMemory: 195035136
bindings:
- airquality
- astro
- avmfritz
- chromecast
- mail
- mihome
- miio
- mqtt
- network
- openweathermap
- openwebnet
- sonoff
clientInfo:
device:
ios: false
android: false
androidChrome: false
desktop: true
iphone: false
ipod: false
ipad: false
edge: false
ie: false
firefox: false
macos: false
windows: true
cordova: false
phonegap: false
electron: false
nwjs: false
webView: false
webview: false
standalone: false
os: windows
pixelRatio: 1.25
prefersColorScheme: light
isSecureContext: false
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: N/A
hardwareConcurrency: 8
language: en-US
languages:
- en-US
- it-IT
- it
- en
onLine: true
platform: Win32
screen:
width: 1536
height: 864
colorDepth: 24
support:
touch: false
pointerEvents: true
observer: true
passiveListener: true
gestures: false
intersectionObserver: true
themeOptions:
dark: light
filled: true
pageTransitionAnimation: default
bars: filled
homeNavbar: default
homeBackground: default
expandableCardAnimation: default
userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/96.0.4664.27 Safari/537.36
timestamp: 2021-11-28T08:54:36.070Z
## Browser console
N/A
## Browser network traffic
N/A
## Additional information
Openhab thread:
https://community.openhab.org/t/script-with-blocky-reschedule-block-triggers-only-once/129190/4
hope it’s the right place
@enrico.mcc The issue has been fixed with 3.2.0. Do you mind adding [SOLVED] to the title here?
Sure, thanks for the fix!