Hi
I’m running OH3.1 snapshot on ubuntu 18.04 system. I have a rule to remind me to cloase the windows.
All is working fin for a couple of days and then (for me out of the blue) it dosn’t send any message. Ther rule is still triggerd. After a systemctl restart openhab it’s working again.
Any sugestions?
rule “RK_Eingang_Zeit”
when Item EingangRK changed to OPEN
then
logError(“testpush.rules”, “RK_Eingang_Zeit Rule gestartet”)
Is this rule defined in a file, or in through the MainUI?
I’d be almost certain your issue is due to the context of the rule and the starting / cancelling of the timer. If you are using a file based rule, then you can try making the timer variable global:
var Timer tNotification
rule “RK_Eingang_Zeit”
when Item EingangRK changed to OPEN
then
logError(“testpush.rules”, “RK_Eingang_Zeit Rule gestartet”)
if(EingangRK.state.toString=="OPEN") {
tNotification= createTimer(now.plusSeconds(600)) [|
if(EingangRK.state.toString=="OPEN") {
sendNotification("xxxxx@xxx.xx", "Riegelkontakt Eingang länger als 10 Minuten offen")
}
]
} else {
if(tNotification !== null) {
tNotification.cancel
tNotification = null
}
}
end
Yes it is a text based rule. There is allready a global variable defined:
var Timer timer
As I have many rouls like this (more or less one for each window) do I have to define a variable for each window/timer:
var Timer timer_1
var Timer timer_2
var Timer timer_3
...
Additional question. As the rule is now I only get once a notification. How I had the rule to change if I wish to recive notifications until I close the window?