The lights wont turn off at 10 pm when there is no motion plus door is open why?
You can see in the first screenshot that two of the ELSE-IF blocks actually evaluate to true. The first of these will be the one that runs. So when motion becomes inactive, the OR conditions allow for the door being open to satisfy that part of the conditional statement, if that makes sense.
When you say the second automation only sometimes works, what exactly does not work? The actions do not run? It does not trigger? To find out, turn on each of the logging options in the rule to see what is happening. The logs are often quite detailed and make it very easy to see what conditional statements are evaluating as and why something isn't working.
the actions do not run
oh I see thanks
But yet its like when the lights look like there going to 100% slowly but then go back down to 20%
Logs will likely be your best bet to diagnose any issues you are having. My suspicion would be crossing the time period and or motion changing, but can't say for certain.