Timer turning lights off after an action

Is there a way to make a light turn on when i come home and then turn the light off after a period of time ?
Ex: Location detected home->turn light on-> set scene → turn light off after x minutes

Thank you