Improving my new automation

Hello all

for many years i have been using home assistant to controll my home heating environment and to manage my media environment. and they work great thanks to the help recieved by this forum

these are all simple automations.

Now I would like to extend my automation (because i have nothing else to do) to include light control.

I dipped my toe in this automation by adding a very this simple automation.
Turn on Stairwell lights.
Trigge: motion detected ( i would eventually change to a lux sensor) via an aeotec multisensor 6
action
device: entrance hall light, action turn entrance hall light on a shelly duo light
device: bedroom landing light: action bedroom landing light on a shelly duo light at 60% (i will enventually add this to a different automation when i will add a multi sensor to the bedrtoom landing(
time : wait 2 minutes
action
device: entrance hall light, action turn entrance hall light off
device: bedroom landing light: action bedroom landing light off

This is working well no issues

I would now like to add a condition that this automation runs after sunset and before sunrise. sounds simple.

Whether I add this condition as a trigger or as an action or in included as part of an if then else statement (which i tried for the first time)
the automation does not work
BTW i would also like to add in the same automation a condition to set the lights to turn on after 23:30 and before 05:00 only at 60 % (is this possible?)

I tried to follow the documentation and several youtube videos on this subject and still i do not know how to insert this condition into the automation.

Can some one pleas assist me in clearing my head and give me guidance on how to do this

Thank so much in advance in helping me on this new adventure