this rule worked fine in OH1.8:
import java.util.Timer
var Timer frontdoor_timer = null
rule "Door left opened too long"
when
Item HM_Frontdoor_State changed
then
if(HM_Frontdoor_State.state == OPEN) {
frontdoor_timer = createTimer(now.plusSeconds(240)) [|
pushover("Haustür steht noch offen")
frontdoor_timer = null
]
} else {
if(frontdoor_timer!= null) {
logInfo("FRONTDOOR","Canceling the Timer")
frontdoor_timer.cancel()
frontdoor_timer = null
}
}
end
since switching to OH2beta5 got the following error:
12:13:27.923 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Door left opened too long’: An error occured during the script execution: Could not invoke method: java.util.Timer.cancel() on instance: org.eclipse.smarthome.model.script.internal.actions.TimerImpl@38bcf6
Any clues?