Myopenhab Push Notification stop working after couple of days

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”)

    if(EingangRK.state.toString=="OPEN") {
        timer = createTimer(now.plusSeconds(600)) [|
        	if(EingangRK.state.toString=="OPEN") {
                  sendNotification("xxxxx@xxx.xx", "Riegelkontakt Eingang länger als 10 Minuten offen")
                  }
        ]
    } else {
        if(timer!==null) {
            timer.cancel
            timer = null
        }
    }

end

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?

I change the rule with Member-trigger (hope this solve my problem):

rule "Fester offen Errinnerung"
when
Member of Fenster changed to OPEN
    then
        if(triggeringItem.state.toString=="OPEN") {
            timer = createTimer(now.plusSeconds(900)) [|
            	if(triggeringItem.state.toString=="OPEN") {
                      sendNotification("xxx@xxx.xx", "Fenster " + triggeringItem.label.toString + " ist seit 15 Minuten offen")
                      }
            ]
        } else {
            if(timer!==null) {
                timer.cancel
                timer = null
            }
        }
end

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.