Switch Templlate Timer

Hi everyone, I’m using switch template to change the icon when I enter the alarm. When the “door entry” alarm (switch on) is activated the icon changes and, on the contrary, when the alarm is switched off (switch off): everything is perfect!

platform: template
switches:
  alarms:
    friendly_name: Protection
    value_template: "{{ is_state('automation.alarms_door_entry', 'on') }}"
    turn_on:
      service: timer.start
      data:
        entity_id: timer.alarm_activated
    turn_off:
      service: script.turn_on
      data:
        entity_id: script.alarm_disabled
    icon_template: >-
      {% if is_state('automation.alarm_door_entry', 'off') %}
      mdi:mdi:shield-off
      {% else %}
      mdi:mdi:shield-check
      {% endif %}

The problem is that I would like to insert a timer that allows me to exit before the alarm is triggered: everything is perfect if, after entering the timer I wait for the switch to activate but, wanting to disable the alarm before the timer is over …I don’t know how to do.
I tried this but it doesn’t work:

value_template: "{{ is_state('timer.alarm', 'started') }}"

Maybe I’m losing myself in a pool of water?
Thank you, your help is greatly appreciated