Automation to reload timer after switch turn off manually

Hi, I have automation to start a timer when valve switch triggered ON, and another automation to cancel and reset the timer when the valve switch triggered OFF (Turn off the timer) but this is not cancel and reset the timer.

timer:
  vtime2:
    duration: "00:00:00"
  
  
automation test:
  - alias: Turn on the timer
    trigger:
      - platform: state
        entity_id: switch.valve_2
        to: 'on'
    action:
      - service: timer.start
        data:
          entity_id: timer.vtime2
          duration: '00:40:00'
          
  - alias: Turn off the timer
    trigger:
      - platform: state
        entity_id: switch.valve_2
        to: 'off'
    action:
      - service: timer.cancel
        entity_id: timer.vtime2

  - alias: timer finished    
    trigger:
      - platform: event
        event_type: timer.finished
        event_data:
          entity_id: timer.vtime2
    action:
      - service: switch.turn_off
        entity_id: switch.valve_2

Any help would be appreciated!

Please dont open duplicate topics. Continue your request for assistance where you started: