Time to leave the light on after last motion is detected problem

Either put in a long timeout, or look at this one. It does not have the schedule, but you can copy that into the condition part and you are done:

One caviat though, the schedule should only apply to on I guess, of it might not turn off id the schedule changes inbetween. Which brings me. back to using separate automations, because the templates would not be needed, the trigger, conditions and actions for both are different, so putting it all in one automation makes it complex.

The blueprint you use has the disadvantage the light won’t turn off if you restart HA inbetween. The example I pointed to does not suffer from it, nor would two automations.

Personally, I prefer to have two simple automations that I understand over having one complex automation that behaves in ways I cannot explain.