- Platform information: Ubuntu 20.04.01
- openHAB version: 2.5.11-1
code server debugger is flagging some timers; can someone tell me why?
error: Cannot refer to the non-final variable timerCloset inside a lambda expression(org.eclipse.xtext.xbase.validation.IssueCodes.invalid_mutable_variable_access)
It’s highlighting the lines:
timerCloset.cancel
timerCloset = null
I’m led to believe that error is telling me not to put the cancel or null inside the timer? If so why would you put it outside the timer. I want to cancel it when the timer is done(after it runs).
Not an engineer; dumb it down please
In the code below:
if (EmergencyRuleShutoff.state == OFF){
var Timer timerCloset = null
timerCloset = createTimer(now.plusSeconds(120))[|
//do stuff here; where i have all my things to do
timerCloset.cancel
timerCloset = null
]
}