Another motion and switch automation test approach - advice needed

You could add your conditions to this:

Motion activated lights automation