Dim and restore light by time

Hi, I am absolutely totally new to HA and I’ve try to read the forum, watch some youtube videos and read some internet articles. But I feel pretty lost on making routines and stuff on here.

I want to make a simple routine, that dim my bathroom light to 10% at time 00:00(12am) and “restore” it to 80% at 10:00 (10am). My bathroom light is turned on by a motion sensor.

How is this done and where to put the different pieces?

My idea is looking something like this:

if time == 00:00
    adjust brightness to 10%
elif time == 10:00
   adjust brightness to 80%

if sensor is triggered
    light.turn_on
delay 5 minutes
    light.turn_off

In advance, thank you for your kind help!

No one who can help me pretty please? :slight_smile: