Hello. My rule is a simple run a timer for X hours… X being a Number item.
When I do not have the .intValue conversion… the error is:
2018-05-07 13:43:47.226 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘poolpump_hourrun_command_rule’: An error occurred during the script execution: Could not invoke method: org.joda.time.DateTime.plusHours(int) on instance: 2018-05-07T13:43:47.223-07:00
When .intValue is there I get this error:
2018-05-07 13:41:30.413 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘poolpump_hourrun_command_rule’: An error occurred during the script execution: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: pool.rules#|::0.2.0.2.0.1.2.0.1::0::/1)
Any ideas on how to get an item value into a timer?
var Timer timer_RunPump = null
rule "poolpump_hourrun_command_rule"
when
Item poolpump_hourrun_number received command
then
if(timer_RunPump !== null){
timer_RunPump.cancel
timer_RunPump = null
}
if(receivedCommand == 0) {
logInfo("rules","pool pump timer disabled.")
}
else {
logInfo("rules","setting pool pump timer for " + receivedCommand.toString + " hours.")
timerGL = createTimer(now.plusHours((receivedCommand as DecimalType).intValue)) [|
logInfo("rules","pool pump timer finished.")
poolpump_hourrun_number.postUpdate(new DecimalType(0))
timer_RunPump = null
]
}
end