Node Red Function question - if statement

Hello All,

Still very new to Node Red and struggling to ask the right questions to find my answer.

I have an existing automation… walk into the garage and the motion sensor recognises someone is there and turns light one… if no one is there any more after 60secs turn off light.

I want to up it to the next level…

I now have a door sensor to the garage so that if the door opens the light turns on… this is faster than the motion sensor.

So now I want the light to stay on if the door closes and the motion sensor inside the garage registers someone is still in the room.

if the door closes and after 30 seconds no motion has been detected it should turn off the light…

I’m thinking like this

if entity1=off and entity2=on
do nothing
entity3=turn off

hope that makes sense :slight_smile:

I found a video where I didn’t need to get into what I thought I needed… I created the following flows and it seems to work