If Else automation for motion and turn on switch/light

It will only fire when motion is detected in the trigger. You could also add when motion is cleared in the trigger and handle that in your action-if section.