Need help to make an automation with motion and dimming

im extremely new to all that have with automation to do, i have only used manuli triggered schens on vera before so i hope someone can help me. (sorry for the bad grammar)

i like the lights 1,2,3 to turn on to 60%, light 4,5 to 100% if motion is detected from sensor1
and if there is no motion in 20 min it should dim the light 4,5 to 50% and if its till no motion after 5min all light turn off. if there is motion after they dim, they return to 100%, this should only run at 18.00-22.00.
If the time is 22.01-06.00 the light turns on to 50% on motion and dimmer to 30% after 10 min if no motion, and turn off after 2 min if no motion.
if the is motions the light shulde go back up to 50%

can anyone help me with this?


Just gonna give you a head’s up — that isn’t going to be easy. You’re either going to need a bunch of invisible entities to track state or move to something like AppDaemon.