Turn off switch 15 minutes after other switch turns off

Hello, my goal its when i turn off the Bath_Light_Switch, if the the Ventilator_Switch is on, it should turn off automaticaly after 15 minutes. But If I mannualy turn the Ventilator_Switch off, the timer stops!

Hi can you post your YAML code of the automation?

Why is important to stop it?

If you don’t stop the timer, at the end of 15 minutes the automation will simply turn off the ventilation_switch that’s already off. Is there a specific reason why you don’t want it to send off to a device that’s already off?

No It’s not important

alias: example
trigger:
  - platform: state
    entity_id: light.bathroom
    from: 'on'
    to: 'off'
condition:
  - condition: state
    entity_id: switch.ventilator
    state: 'on'
action:
  - delay: '00:15:00'
  - condition: "{{ is_state('switch.ventilator', 'on') }}"
  - service: switch turn_off
    target:
      entity_id: switch.ventilator

ok thank you, it works :ok_hand:

1 Like