Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 99014

How to restart / reload timer / script

$
0
0

@MarkB1 wrote:

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?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 99014

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>