Turn light on with motion sensor and keep it on if door sensor is off

Hello,
I want to create bathroom automation using motion sensor and door sensor. If some entered bathroom, light should turn on and turn off with 1 minute delay when person leave bathroom . If some entered bathroom and closed the door , light should turn on untill door is opened and no motion detected within 1 minute.
Please help with this. I spent 3 days on this task ))))

I made a blueprint for this situation but it also is for a fan. You can probably look it over and figure this out.

usually it’s best to post the code for what you have tried to help us help you.

Tell us what isn’t working as expected.

be sure to paste code and not a screenshot and properfly format it using three backticks (```) on the line before and after the code block.

See if this blueprint here will address what you’re trying to do:

@lensherm , I have added this blueprint. Thank you for your help. Can you please tell me how to turn light on using this blueprint ?
I have filled in all necessary data