I have just implemented something very similar using Jython. I needed some help, so it’s not a complete solution, but it may be useful: Passing a timer handle between rules and functions - #13 by hafniumzinc
Take note of the recommendation about what type of timer to use…