Rule, Push when Window 10 Minutes open

Can anybody help me with a rule?

I want a push message when window is 10 minutes open.
Eg when ItemWinter is ON and WDSFensterSchlafzimmer is more then 10 Minutes OPEN then Pushover…

there are several rule examples in the forum (search for design patterns)

it is more beneficial for you to see those examples, understand them and then create your own rule (this will help you in your future developments of openHAB rule logic)
you can post it here for validation and/or optimization, but you won’t find many who are willing to type it up from scratch for you :slight_smile:

Here is my approach:

You need a persistence service, otherwise you can’t check for the duration.

Thanks for help, it works

Great that you got it to work. Would you be willing to describe how you did it?

sure

rule "Dachfenster Check Item ON"

when 
  Item WDSDachfensterDach_Contact changed to OPEN
then
  createTimer(now.plusSeconds(600))[|
  sendCommand(VirtualItemFensterDachCheck,ON)]
  createTimer(now.plusSeconds(602))[|
  sendCommand(VirtualItemFensterDachCheck,OFF)]
end


rule "Dachfenster Push"
when
  Item VirtualItemFensterDachCheck changed to ON
then
   if(VirtualItemWinter.state == ON && WDSDachfensterDach_Contact.state == OPEN){
    pushover ("Dachfenster offen")}
end

Thanks, now this topic is complete :wink:

Just one question: Why do you use the second timer?
I would put sendCommand at the end of the second rule (or even only a postUpdate).

Yes you are right, i dont need the second timer. I am new on openHAB.
:confused:

I am new too :slight_smile: We are here to learn :wink:

One other thing to remark: This one

VirtualItemFensterDachCheck.sendCommand(ON)

Is better than

sendCommand(VirtualItemFensterDachCheck,ON)

That’s what the manual says: https://docs.openhab.org/configuration/rules-dsl.html#deeper-dive

Thank’s for your help, I used some concepts to write my own rule: https://community.openhab.org/t/39843