Can you please have a look to my openhab.log

I am now successfuly running this rule for a timer latch design but my log looks terrible.
Maybe the rule isn´t correct yet?

the only rule in use (successfuly working):

var Timer shutoffTimer= null
var DateTime lastRun = now.minusMinutes(1) // on a reboot switch on sirene on the first event

rule “PIR Neo_PIR_1 for Switch with Siren”

when

	Item NEO_PIR_1_Bewegung changed from OFF to ON
	
then
	if(AlarmInnen.state==ON) {
		if(lastRun.isBefore(now.minusMinutes(1))) {
			if(shutoffTimer==null) {
			sendCommand(zwave_device_296beed3_node4_switch_binary, ON)
				lastRun = now
			logInfo("RuleInfo", "Siren START")
			timer = createTimer(now.plusSeconds(10)) [|
				sendCommand(zwave_device_296beed3_node4_switch_binary, OFF)
				logInfo("RuleInfo", "Siren STOP")
			timer = null
				]
			}
		}
	}

end

openhab.log:

2018-03-04 16:42:58.059 [INFO ] [ipse.smarthome.model.script.RuleInfo] - Siren START
2018-03-04 16:42:58.247 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘PIR Neo_PIR_1 for Switch with Siren’: An error occurred during the script execution: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: G11.rules#|::0.2.0.2.0.0.1.0.0.1.0.0.1.0.3::0::/1)
2018-03-04 16:43:08.108 [INFO ] [ipse.smarthome.model.script.RuleInfo] - Siren STOP
2018-03-04 16:43:08.115 [ERROR] [org.quartz.core.JobRunShell ] - Job DEFAULT.2018-03-04T16:43:08.066+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
sendCommand(,)
logInfo(,)
.timer =
} ] threw an unhandled Exception:
java.lang.IllegalArgumentException: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: G11.rules#|::0.2.0.2.0.0.1.0.0.1.0.0.1.0.3.7.6.1.1.0.2::0::/1)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.assignValueTo(XbaseInterpreter.java:1224) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:1212) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:215) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) [145:org.eclipse.smarthome.model.script:0.10.0.b1]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) [145:org.eclipse.smarthome.model.script:0.10.0.b1]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) [164:org.eclipse.xtext.xbase:2.12.0.v20170519-0752]
at com.sun.proxy.$Proxy153.apply(Unknown Source) [?:?]
at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) [145:org.eclipse.smarthome.model.script:0.10.0.b1]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [115:org.eclipse.smarthome.core.scheduler:0.10.0.b1]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [115:org.eclipse.smarthome.core.scheduler:0.10.0.b1]
2018-03-04 16:43:08.149 [ERROR] [org.quartz.core.ErrorLogger ] - Job (DEFAULT.2018-03-04T16:43:08.066+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
sendCommand(,)
logInfo(,)
.timer =
} ] threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [115:org.eclipse.smarthome.core.scheduler:0.10.0.b1]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [115:org.eclipse.smarthome.core.scheduler:0.10.0.b1]
Caused by: java.lang.IllegalArgumentException: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: G11.rules#|::0.2.0.2.0.0.1.0.0.1.0.0.1.0.3.7.6.1.1.0.2::0::/1)
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.assignValueTo(XbaseInterpreter.java:1224) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:1212) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:215) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227) ~[?:?]
at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
at com.sun.proxy.$Proxy153.apply(Unknown Source) ~[?:?]
at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
… 1 more

You defined a timer as a global variable, but you are using another name in the rule. Also, when checking if shutoffTimer is null, you should use === instead of ==. If you look in your openhab.log file when you save the file, you’ll see validation errors, which will help figure out the problems, even if the file still loads. You’d probably see all the errors if you were using VS Code with the OH extension. Hope this helps!

Hi Scott,
I am not really experienced in coding. The warning in openhab.log I realized and changed to === instead. But could you maybe help me and correct my rule for the correct timer usage?
The only thing I can say currently it works but of course I would prefer an error free rule.

Thanks a lot

var Timer shutoffTimer = null
var DateTime lastRun = now.minusMinutes(1)// on a reboot switch on sirene on the first event

rule "PIR Neo_PIR_1 for Switch with Siren"
when
    Item NEO_PIR_1_Bewegung changed from OFF to ON
then
    if (shutoffTimer === null && AlarmInnen.state == ON && lastRun.isBefore(now.minusMinutes(1))) {
        zwave_device_296beed3_node4_switch_binary.sendCommand(ON)
        lastRun = now
        logInfo("RuleInfo", "Siren START")
        shutoffTimer = createTimer(now.plusSeconds(10)) [|// you should have been using the global variable here
            zwave_device_296beed3_node4_switch_binary.sendCommand(OFF)
            logInfo("RuleInfo", "Siren STOP")
            shutoffTimer = null// and here
        ]
    }
end

I took the liberty of collapsing your if/then blocks too, but this should get you there! I added comments where I made changes. Does seeing it help you to understand what was needed?

Hi Scott,
finding now the time to check the modified rule.
One thing I don´t understand:


var DateTime lastRun = now.minusMinutes(1)// on a reboot switch on sirene on the first event


what does the command “= now.minusMinutes(1)” mean and why 1 Minute?
Don´t understand what it has to do with a reboot?

Thanks a lot
Boris

I have no idea… I only copied what you had posted.

It looks like this sets the variable to a value that would allow the rule to run the first time it is triggered after an OH restart or rule file save.