Hello,
I am starting out on openhab and I must say that I like it a lot. There is only one thing I do not get working properly.
Yesterday it worked fine, but today I am fiddling around with the code and I broke it somehow.
The example I got my code from is https://github.com/openhab/openhab/wiki/AlarmClock
What I got in my rule file is:
import org.openhab.model.script.actions.Timer
import org.joda.time.*
var Timer Wakeuptimer
rule "Set alarm" //--------------------
when
Item Wakeup_Time received update or
Item Wakeup_alarm received update
then
logInfo("rules", "set alarm rule activated. Wakeup_Time = [{}]. Wakeup_alarm=[{}]", Wakeup_Time.state, Wakeup_alarm.state)
if (Wakeuptimer!=null)
Wakeuptimer.cancel()
logInfo("rules", "Alamtimer is set to start next alarm at: [{}].", Wakeup_Time.state)
var Wakeuptimer=createTimer(Wakeup_Time) [|
if (Wakeup_alarm.state == ON)
Wakeup_event.sendCommand(ON)
]
end
When the rule gets triggered I get the following message in my logfile:
2016-02-28 23:55:37.957 [INFO ] [org.openhab.model.script.rules] - set alarm rule activated. Wakeup_Time = [2016-02-29T08:00:00]. Wakeup_alarm=[ON]
2016-02-28 23:55:37.960 [INFO ] [org.openhab.model.script.rules] - Alamtimer is set to start next alarm at: [2016-02-29T08:00:00].
2016-02-28 23:55:37.962 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Set alarm': Could not invoke method: org.openhab.model.script.actions.ScriptExecution.createTimer(org.joda.time.base.AbstractInstant,org.eclipse.xtext.xbase.lib.Procedures$Procedure0) on instance: null
Why does it have a problem with the fact that the timers instance is null?
Am I missing something or doing something stupid?