Simple Automation for binary sensors never trigger

I just created a simple automation for sonoff switch and binary sensor but never get tregged.

- id: 'XXXXXXXNUMBER'
  alias: 'Turn off the Hall Sala after 5 minutes '
  description: 'Should trigger when the door change the status from open to closed and the light of my hall way was turned on after 5 minutes'
  trigger:
  - platform: state
    entity_id: binary_sensor.sonoff_a4400038ab
    to: 'closed'
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: switch.sonoff_1000f253fa
      state: 'on'
      for: 00:05:00
  action:
  - service: switch.turn_off
    target:
      entity_id: switch.sonoff_1000f253fa
  mode: restart

What am I doing wrong here?

Best regards,

Eduardo

trigger:
  - platform: state
    entity_id: binary_sensor.sonoff_a4400038ab
    to: 'off'

I changed the code to this one below and it still doesn’t work.

- id: '1615839293656'
  alias: 'Turn off the Hall Sala after 5 minutes '
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.sonoff_a4400038ab
    to: 'off'
  condition:
  - condition: state
    entity_id: switch.sonoff_1000f253fa
    state: 'on'
    for: 00:00:10
  action:
  - service: switch.turn_off
    target:
      entity_id: switch.sonoff_1000f253fa
  mode: single

Let me explain better my idead and the logic.

I already have a scene when the door open turn the entrance light on (switch.sonoff_1000f253fa), so my Idea is turn it off after a few minutes that I closed the door.

Ok, the logic that I want is:

When my door changes the state from open to close and the switch.sonoff_1000f253fa is on then the switch.sonoff_1000f253fa should turn_off.

In my condition I am using the property for to combine the state on for X minutes.

is that correct ? or what I need to change to accomplish that result?

The following requirements:

do not have the 5 minute time period you attempted to use in your first automation. Have your requirements changed?

Use - delay: 00:10`

- id: '1615839293656'
  alias: 'Turn off the Hall Sala after 5 minutes '
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.sonoff_a4400038ab
    to: 'off'
  condition:
  - condition: state
    entity_id: switch.sonoff_1000f253fa
    state: 'on'
  action:
  - delay: 00:10
  - service: switch.turn_off
    target:
      entity_id: switch.sonoff_1000f253fa
  mode: single

Hi Tara it is 5 minutes delay

Thanks man, that works just fine.