Turn On Hue Lights When Motion is Detected, Turn off when motion is not detected for 1 minute

I’m using Iris motion sensor alongside a Hue light bulb. Turning on the lights when motion is detected works perfectly, however turning off at 1 minute is not.

My code

- alias: On Master Bathroom Lights Motion Detected
  trigger:
    platform: state
    entity_id: binary_sensor.centralite_3326l_0ba73ece_1
    to: 'on'
  condition:
    condition: sun
    after: sunset
    after_offset: "-00:15:00"    
  action:
    service: light.turn_on
    entity_id: light.bedroom_hallway
    
- alias: Turn OFF Master Bathroom Lights
  trigger:
    platform: state
    entity_id: binary_sensor.centralite_3326l_0ba73ece_1
    to: 'off'
    for:
      minutes: 1
  action:
    service: light.turn_off
    entity_id: light.bedroom_hallway

What am I doing wrong?

Does the sensor send an “off” message? A lot of sensors don’t send an indication of no motion. Otherwise the automation looks good.

this is mine… I used from on to off, not sure if that will help. Hue GU10s. I use a condition to only run if the lights are on.

alias: bathroom lights off
trigger:
  - platform: state
    entity_id: binary_sensor.bathroom_sensor
    from: 'on'
    to: 'off'
    for:
      minutes: 2

condition:
  - condition: state
    entity_id: light.bathroom  
    state: 'on'

action:
  - service_template: light.turn_off
    entity_id: light.bathroom

Thank you for your response. I’m transitioning from Smartthings and it was working great, so I’m guessing the Iris motion detector sends a signal when motion is not detected.

@MarkR thanks for the code. I’ll give that a try.

I’ve noticed that you have “service_template:” instead of “service” what is the difference? Sorry I’m a complete newbie.