Well, the first place to look is the docs.
createTimer(AbstractInstant instant, Procedure procedure)
: schedules a block of code to execute at a future time
instant
is usually aDateTime
calculated using the built in variablenow
.procedure
is the block of code and is defined using lambda notation (i.e. square brackets)
It’s kind of pointless to schedule a timer for now
. It will run immediately.
It’s very dangerous to reschedule a timer forever. What if those two Items never become go to OFF? the timer will never exit and run forever (which was a really really dangerous part of your original rule).
Why not skip most of this complexity? OH is an event based system. This is a standard [Deprecated] Design Pattern: Motion Sensor Timer problem. See that post for proper ways to implement something like this. Or even better, install a rule that does this from the marketplace: Open Reminder [3.3.0;3.4.9).