Help needed with home assistant automation editor

Hi,
Trying to add an automation for room lights to turn on and off from a motion sensor. I have created the automation to turn on the light, but need to know what to add to the turn off automation in the editor to turn the light of if the pir does not detect motion for 10 minutes. On the older version I used for: minutes: 10 on the trigger. Not sure how to do this with the editor…

After that I also need to be able to only use the automation if the light was turned on in the first place. So basically none of the automation must run unless the light was turned on. This way the light turns off when my son leaves the room (if the light was on) , and back on when he enters.