Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions source/_docs/scripts.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Delays are useful for temporarily suspending your script and start it at a later

### {% linkable_title Wait %}

Wait until some things are complete. We support at the moment `wait_template` for waiting until a condition is `true`, see also on [Template-Trigger](/docs/automation/trigger/#template-trigger). It is possible to set a timeout after which the script will abort its execution if the condition is not satisfied. Timeout has the same syntax as `delay`.
Wait until some things are complete. We support at the moment `wait_template` for waiting until a condition is `true`, see also on [Template-Trigger](/docs/automation/trigger/#template-trigger). It is possible to set a timeout after which the script will continue its execution if the condition is not satisfied. Timeout has the same syntax as `delay`.

{% raw %}
```yaml
Expand All @@ -92,9 +92,10 @@ Wait until some things are complete. We support at the moment `wait_template` fo

{% raw %}
```yaml
# wait until a valve is < 10 or abort after 1 minute.
- wait_template: "{{ states.climate.kitchen.attributes.valve|int < 10 }}"
# wait for sensor to trigger or 1 minute before continuing to execute.
- wait_template: "{{ is_state('binary_sensor.entrance', 'on') }}"
timeout: '00:01:00'
continue_on_timeout: 'true'
```
{% endraw %}

Expand All @@ -120,6 +121,17 @@ It is also possible to use dummy variables, e.g., in scripts, when using `wait_t
```
{% endraw %}

You can also get the script to abort after the timeout by using `continue_on_timeout`

{% raw %}
```yaml
# wait until a valve is < 10 or continue after 1 minute.
- wait_template: "{{ states.climate.kitchen.attributes.valve|int < 10 }}"
timeout: '00:01:00'
continue_on_timeout: 'false'
```
{% endraw %}

### {% linkable_title Fire an Event %}

This action allows you to fire an event. Events can be used for many things. It could trigger an automation or indicate to another component that something is happening. For instance, in the below example it is used to create an entry in the logbook.
Expand Down