Help with Motion Blueprint

Hi,

Hope someone can help, I’m trying to create a automation where if motion is detected then my mirror lights come’s on and stay’s on for 60 seconds and then turn’s off this part i have managed to do myself, but i cant figure out is how to add exception that if motion is detected but if the main light is turned on (both before and after motion is detected) then the mirror light wont turn on i also want this automation to only run from 9am to 3am and finally want to change the turn off state of my original automation to return to previous state

alias: MIrror
description: ""
trigger:
  - type: motion
    platform: device
    device_id: af0fce44970ddcc4af9d72175f123548
    entity_id: binary_sensor.motion_1_iaszone
    domain: binary_sensor
condition: []
action:
  - type: turn_on
    device_id: 46ad28f38504f13149924f526f2b0ce8
    entity_id: switch.sonoff_100168352a_1
    domain: switch
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 46ad28f38504f13149924f526f2b0ce8
    entity_id: switch.sonoff_100168352a_1
    domain: switch
mode: single