The issue is in your automation in HA. You have to have an and statement in there. IF the switch is on AND there is motion THEN turn on light. The switch would be DETACHED and used independently within HA as a binary sensor. With the switch on, any motion would activate the light on, when motion is not seen, then the light will turn off. Further, if the switch is switch off the light would turn off immediately. But be careful with mothion sensors, sometimes a second automation to set a timer is nice to have if the motion clears too quickly.