Create timer not undefined for Class <Timer>

Good Afternoon,

I’ve been trying to configure a timer for a rule that I’m testing and every time I call the function createTimer I get the error message “The method createTimer(DateTime, ()=>Timer) is undefined for the type Class”

Does anyone know what might be causing this error to occur?

Here’s my code:
var Timer timer = null

rule “Motion Alarm”
when
Item MAlarmMotion changed from OFF to ON
then
SwitchBinaryAlarm.sendCommand(ON)
logInfo(“Test”, “Motion Detected”)

if(timer === null){
timer = Timer.createTimer(now.plusMillis(100)) [|
    SwitchBinaryAlarm.sendCommand(OFF)
    timer = null
]
}

end

Thank you in advance.

You just call createTimer, not Timer.createTimer. And even if the call required is to reference Timer, the way to access static methods on a class in Rules DSL is by using :: as in Timer::createTimer.

It worked, thank you!