I have a timer which I want to reschedule. All the examples I can find are based on [now] + [some time]. I would like to reschedule my timer based on [time of timer] + [some time].
Ideally what I would like is something like this:
var LocalDateTime time = null
var Timer timer = null
rule "Example rule"
when
Item Sensor_State changed to ON
then
if (timer === null || timer.hasTerminated) {
time = now.plusSeconds(30);
timer = createTimer(time, [|
// Do something
]);
} else {
time = time.plusSeconds(10);
timer.reschedule(time);
}
end
Problem is that it’s not possible to invoke plusSeconds on the LocalDateTime object. I’ve tried using different objects but I get the same problem if I use DateTimeType or Instant.
Is this possible? And if so what am I doing wrong here?