Automations with two triggers, one get canceled

Hi

I’m have some motion sensors, which only send command for “on”, so I created an automation for turning them off after 2 minutes.

Problem is that if PIR 1 turns on at minute 0, PIR 2 turns on at minute 1, PIR 1 turns off after being on for 2 minutes, but then PIR 2 keeps on. It’s like the automation stop watching for PIR2, since it just complete with PIR1?

- alias: 'RFlink - Sluk PIR'
  trigger:
    - platform: state
      entity_id: light.rfpir_stue, light.rfpir_gang
      to: 'on'
      for:
        minutes: 2
  action:
    - service: light.turn_off
      data_template:
        entity_id: "{{ trigger.entity_id }}"

Hi,

Maybe you need to do a script, that after 2 mintunes, both PIR turno off.

In my case i have an script, that when motion sensor turn on, execute a script, that turn on light during 3 minuts, and then turn off light.

script code (script.yaml)

timed_lamp:
  alias: 'Enciende la lampara del Pasillo'
  sequence:
    # Cancel ev. old timers
    - service: script.turn_off
      data:
         entity_id: script.timer_off
    - service: light.turn_on
      data:
        entity_id: light.yeelight_white_f0b4xxxxxx
        brightness: 10

        transition: 2
    # Set new timer
    - service: script.turn_on
      data:
        entity_id: script.timer_off
timer_off:
  alias: 'Apaga la lampara del pasillo despues de 3 minutos'
  sequence:
    - delay:
        minutes: 3
    - service: light.turn_off
      data:
        entity_id: light.yeelight_white_f0bxxxxxxx
        transition: 10

And this one is the automation that execute the script:

alias: Luz_Pasillo_Noche_Mov_Hab1
hide_entity: False
initial_state: 'off'
trigger:
  platform: state
  entity_id: binary_sensor.motion_sensor_158xxxxxxxxx
  to: 'on'
action:
  service: homeassistant.turn_on
  entity_id: script.timed_lamp

So maybe you can use a script that after 2 minuts turn off each PIR by individually.