Make automation trigger run continually, not only when state changes

I’ve modified the built-in motion activated light blueprint to work with an outdoors light I have. The main thing I’ve done is added a 10 second delay after the light turns back off before the automation is allowed to run again. The reason for this is because I’m using a camera for the motion detection, and when the light turns off, it causes the motion detection to see motion (due to the large scale lighting change). So without this 10 second delay, it will keep being reactivated by itself infinitely.

My problem is that if legitimate motion occurs within this 10 second window, the light will not turn back on again until the motion stops, stays stopped for a period of time, then starts again. I believe this is because the automation trigger only works when the state changes. So, when my trigger is looking for motion_entity to have state “on”, it has to change to on from something else. If it’s already on to begin with then the trigger won’t work.

How can I fix this? Is there a way to make it check the trigger e.g. once every second, rather than only when it changes?

blueprint:
  name: Motion-activated Light (Outdoors)
  description: Turn on a light when motion is detected.
  domain: automation
  author: Home Assistant
  input:
    motion_entity:
      name: Motion Sensor
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: light
    no_motion_wait:
      name: Wait time
      description: Time to leave the light on after last motion is detected.
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
    light_off_wait:
      name: Light off wait time
      description: Time to leave the light off before allowing it to be triggered again.
      default: 10
      selector:
        number:
          min: 0
          max: 60
          unit_of_measurement: seconds
    sun_entity:
      name: Sun entity
      description: This is normally "sun.sun".
      default: sun.sun
      selector:
        entity:
          domain: sun

# If motion is detected within the delay,
# we restart the script.
mode: single
max_exceeded: silent

trigger:
  platform: state
  entity_id: !input motion_entity
  #from: "off"
  to: "on"

condition:
  # Only run between sunset and sunrise
  - condition: numeric_state
    entity_id: !input sun_entity
    attribute: elevation
    below: 0

action:
  - alias: "Turn on the light"
    service: light.turn_on
    target: !input light_target
  - alias: "Wait until there is no motion from device"
    wait_for_trigger:
      platform: state
      entity_id: !input motion_entity
      from: "on"
      to: "off"
  - alias: "Wait the number of seconds that has been set"
    delay: !input no_motion_wait
  - alias: "Turn off the light"
    service: light.turn_off
    target: !input light_target
  - alias: "Wait the number of seconds that has been set for light off wait"
    delay: !input light_off_wait

You can’t fix that. A motion sensor has a cool down period and during this time it will not change state.
This is a limitation of the device not HA.
I believe what you need is mmwave sensor instead but that will probably open up other problems.

One thing you could try is to set up a trigger on on for 11 seconds. But that won’t be true if the actual motion starts a few seconds after the counter starts.

Using camera as motion sensor is very inaccurate, unless camera is VERY expensive (and even then…). Camera will detect leaves, debree, a car lights passing by…you name it… and turn on light, so basically you’l have a light-show all night.
So, i’d say that your problem is in type of sensor used. You’ll have to switch to IR, MW sensor (or combo of those: alarm sensors exist in bi-technology).
Or, you can try LD2410 presence sensor - it’s pretty neat stuff.

Just reset the timer for turn off every time motion is detected. I use AI cameras and use human not motion. So long as a human was detected in the last 10 minutes the timer to off continues to reset and never trigger

I use this in my garage.

Where yours starts counting the moment it turn to off and doesn’t reset.

alias: MOTION - Garage lighting OFF
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.garage_camera_smart_motion_human
    to: "off"
    from: "on"
    for:
      hours: 0
      minutes: 10
      seconds: 0
condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
action:
  - type: turn_off
    entity_id: switch.garage_lights
    domain: switch
mode: single

If you don’t want the light to trigger motion add an action to disable the light on automation, turn the light off, then re-enable the light on automation so it doesn’t cycle infinitely