No motion automation, time period problem

I have an automation to turn on lights in my kitchen and living room if motion is detected, and luminance is below a certain level. This works as expected.

However, an automation to turn off lights if there is no motion for 30 min, between 10 pm and 6 am, does not work consistently. I’ve realized that the way the automation really works is, “during the period between 10 pm and 6 am,” if sensor reports motion -> no motion edge, then start timer and turn off after 30 min if not reset.

But this would not be the expected behavior. I would expect this to work like, at 10 pm, check to see if motion sensor is reporting no motion. If so, then start a timer for 30 min, reset only if there is a motion event.

Basically it seems the “no motion” is not really the state of “no motion,” but the state change between motion to no motion.

Am I missing something here? How would I set an automation to turn off the lights during a certain time range, if there is nobody at home to trigger the initial motion that would allow for a motion to no motion state change?

Thanks!