Blink & Tuya - Help with Motion Activating Light Switches

Hi everyone,

I am a little new to this, but I finally got my entire system running properly. I’m struggling with automation though.

Home Assistant on Raspberry Pi 4
1x USB Aeotec Z Stick 5+ (hub/controller)
1x Aeotec Z Wave extender
1x Yale Z Wave deadbolt
1x Alarm.com Z Wave thermostat
3x WiFi light switches (Treatlife brand, but they’re controlled through Tuya)
2x Echo Dot (via HA Cloud)
3x Google Home Mini (via HA Cloud)
3x Blink outdoor cameras
1x Blink doorbell

My Blink cameras have a motion sensor in them that triggers recording. Home Assistant sees this motion sensor as ‘binary_sensor.blink_cameraname_motion_detected’. I have WiFi light switches (seen as ‘switch.switchname_switch_1’ in HA) that I want to be turned on when certain cameras sense movement. Which that in itself does work. I need to do 2 more things with it though. I need to specify how long the light will remain on and I need it to be conditional based on whether the light was already on or not. The automation should only run if the light switch is off.

Alexa has routines but I can’t make it conditional based on whether the light is already on or not. Can anyone point me in the right direction?