It is best to avoid devices in automations any time you can.
For triggers and conditions, state or numerical state are most used. For motion, it would most likely be state. From there you can pick the entity.
For actions, services are most used. To turn a light on, light.turn_on would be the right pick (unless it is defined as a switch, then switch.turn_on). There too the entities can be selected, along with service specific other options (e.g. light brightness if it supports that).
Services also support templates, this is a relevant example automation for just your use case: