How to restart / reload timer / script

So my scenario is as follows.

I Trigger my Automation to start a timer.

  trigger:
  - entity_id: binary_sensor.motion_detector_bathroom
    platform: state
    to: 'on'
  condition:
  - condition: not
    conditions:
    - condition: state
      entity_id: timer.bathroom_extractor_fan_on_time
      state: active
  action:
  - data_template:
      duration: 00:00:{{ states.input_number.extractor_fan_delay.state | int }}
      entity_id: timer.bathroom_extractor_fan_delay
    service: timer.start

After the timer has elapsed another Automation triggers a script

- id: '1590248302612'
  alias: BATHROOM EXTRACTOR FAN RUN TIME
  description: ''
  trigger:
  - entity_id: timer.bathroom_extractor_fan_delay
    platform: state
    to: idle
  condition: []
  action:
  - data: {}
    service: script.1590247487069

The Script the triggers another timer and also a relay output to turn on the fan

'1590247487069':
  alias: Bathroom Extractor Run Time
  sequence:
  - data_template:
      duration: 00:{{ states.input_number.extractor_fan_run_time.state | int }}
      entity_id: timer.bathroom_extractor_fan_on_time
    service: timer.start
  - data: {}
    entity_id: switch.extractor_fan_relay
    service: switch.turn_o

After the timer has elapsed another automation turns of the relay / fan

- id: '1590248678506'
  alias: BATHROOM EXTRACTOR FAN OFF
  description: ''
  trigger:
  - entity_id: timer.bathroom_extractor_fan_on_time
    platform: state
    to: idle
  condition: []
  action:
  - data: {}
    entity_id: switch.extractor_fan_relay
    service: switch.turn_off

So what I am trying to achieve now is that if another trigger is detected during the timer / script running can I reset / restart the timer.

I have looked at the Docs. and it seems you cannot reload.timer / reload.script or start.timer / reload.timer if one is active?

`- id: '1590253197249'
  alias: BATHROOM EXTRACTOR RESTART TIMER
  description: ''
  trigger:
  - entity_id: binary_sensor.motion_detector_bathroom
    platform: state
    to: 'on'
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: timer.bathroom_extractor_fan_on_time
      state: active
  action:
  - data: {}
    service: script.1590247487069``

This does not work.
Any thoughts, suggestions?

- id: '1590253197249'
  alias: BATHROOM EXTRACTOR RESTART TIMER
  description: ''
  trigger:
  - entity_id: binary_sensor.motion_detector_bathroom
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: timer.bathroom_extractor_fan_on_time
    state: active
  action:
  - service: script.turn_off
    entity_id: script.1590247487069
  - data: {}
    service: script.1590247487069

EDIT: Wait a second…

Why doesn’t it work? It should. Given that the script does not have any delays or wait_templates, you shouldn’t have to do what I just showed above. It should have worked the way you had it.

The timer needs to be cancelled then started, not turning off the script.

The fan off automation trigger would need to change for this to work as intended.

- id: '1590248678506'
  alias: BATHROOM EXTRACTOR FAN OFF
  description: ''
  trigger:
  - platform: event
    event_type: timer.finished
    event_data:    
      entity_id: timer.bathroom_extractor_fan_on_time
  condition: []
  action:
  - data: {}
    entity_id: switch.extractor_fan_relay
    service: switch.turn_off
- id: '1590253197249'
  alias: BATHROOM EXTRACTOR RESTART TIMER
  description: ''
  trigger:
  - entity_id: binary_sensor.motion_detector_bathroom
    platform: state
    to: 'on'
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: timer.bathroom_extractor_fan_on_time
      state: active
  action:
  - service: timer.cancel
    entity_id: timer.bathroom_extractor_fan_on_time
  - data: {}
    service: script.1590247487069

UPDATE.

It works fine as is, must of forgotten to reload scripts and automation.

When I re trigger the P.I.R. input timer resets to the predetermined value and begins to count down again, relay status remains as is (ON) until timer reaches 0 .

Full code as is of now.

/config/configuration.yaml

- id: '1590242331904'
  alias: BATHROOM EXTRACTOR FAN ON DELAY
  description: ''
  trigger:
  - entity_id: binary_sensor.motion_detector_bathroom
    platform: state
    to: 'on'
  condition:
  - condition: not
    conditions:
    - condition: state
      entity_id: timer.bathroom_extractor_fan_on_time
      state: active
  action:
  - data_template:
      duration: 00:00:{{ states.input_number.extractor_fan_delay.state | int }}
      entity_id: timer.bathroom_extractor_fan_delay
    service: timer.start
- id: '1590248302612'
  alias: BATHROOM EXTRACTOR FAN RUN TIME
  description: ''
  trigger:
  - entity_id: timer.bathroom_extractor_fan_delay
    platform: state
    to: idle
  condition: []
  action:
  - data: {}
    service: script.1590247487069
- id: '1590248678506'
  alias: BATHROOM EXTRACTOR FAN OFF
  description: ''
  trigger:
  - entity_id: timer.bathroom_extractor_fan_on_time
    platform: state
    to: idle
  condition: []
  action:
  - data: {}
    entity_id: switch.extractor_fan_relay
    service: switch.turn_off
- id: '1590253197249'
  alias: BATHROOM EXTRACTOR RESTART TIMER
  description: ''
  trigger:
  - entity_id: binary_sensor.motion_detector_bathroom
    platform: state
    to: 'on'
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: timer.bathroom_extractor_fan_on_time
      state: active
  action:
  - data: {}
    service: script.1590247487069

/config/scripts.yaml

'1590247487069':
  alias: Bathroom Extractor Run Time
  sequence:
  - data_template:
      duration: 00:{{ states.input_number.extractor_fan_run_time.state | int }}
      entity_id: timer.bathroom_extractor_fan_on_time
    service: timer.start
  - data: {}
    entity_id: switch.extractor_fan_relay
    service: switch.turn_on

All that remains for now is to add the humidity control as trigger but that should not be a problem.
Regards,