Create Timers with rules and react (e.g. Door is Open > 10 Minutes)

Hi there,

could please somebody point me in the right direction on how to use timers i.e. for alarm states?

Let’s say I have a door contact and I would like to be alarmed (notified) i.e. when the door is open for more than 1h.

I would like to have two rules creatin g/ deleting and triggering on some timer-events.

Rule “Door”
when
Item “Door” changed
then
if(Door.state == OPEN) {
// Pseudo Code
Create Time (“DoorTimer”)
} else {
Destroy Timer (“DoorTimer”)
}
end


Rule “DoorTimer Alarm”
when
// Pseudo CODE:
// Item “DoorTimer” triggered 10 Minutes
then
// Pseudo Code:
NotifiyMe (“Attention Door is > 10 Minutes open! Consider to close!”
end

Could please some give me some code examples I could study or some documentation?

thank you sihui. your reference is what I was looking for.