Single run automation with motion sensor

I have an automation for when there is motion in my office it turns on some LED strips. It works for the most part but then I wanted to prevent it from constantly triggering. Setting the mode to single works correctly that it will only run one time then wait 5 minutes. My issue is this is the lights will not turn on after the first pass and then not again until I restart automation. Best guess is it seems to be stuck on the wait part an never completing from some run where the lights did not turn on based on the condition. Subsequent triggers will give the message that was something like did not run because in single mode.

I have another automation where if there is no motion detected for 5 minutes the lights turn off. That one works. My goal is when I enter the office and it is at night the lights turn on and stay on until there is no motion for 5 minutes. I do not want to be constantly sending turn on commands or using system resources to check on conditions like are these lights already on every time the motion sensor flips for 10 seconds. I would also like to remove or shorten the 10 second on the trigger but again do not want to be constantly using resources.

trigger:
  - type: motion
    platform: device
    device_id: 32165498765416158961
    entity_id: binary_sensor.off_motion
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
action:
  - service: light.turn_on
    target:
      entity_id:
        - light.off_desk_lights
        - light.off_strip_shelf
    data:
      brightness: 255
      rgb_color:
        - 255
        - 0
        - 0
  - wait_template: '00:05:00'
    continue_on_timeout: true
mode: single

The resources used to evaluate the condition are minimal. Plus you are overlooking the fact that resources will be used anyway because your automation will continue to trigger every time the binary_sensor changes state … and then it will evaluate the existing State Condition (for sun.sun).

The following version will turn on the lights but only if both or one of the lights is currently off. If both are already on, it will not execute the action.

alias: example
trigger:
  - type: motion
    platform: device
    device_id: 32165498765416158961
    entity_id: binary_sensor.off_motion
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
variables:
  office_lights:
    - light.off_desk_lights
    - light.off_strip_shelf
condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  - "{{ expand(office_lights) | selectattr('state', 'eq', 'on') | list | count != office_lights | count }}"
action:
  - service: light.turn_on
    target:
      entity_id: '{{ office_lights }}'
    data:
      brightness: 255
      rgb_color:
        - 255
        - 0
        - 0
mode: single
max_exceeded: silent

It’s also easily extensible; simply add more lights to the office_lights variable.