mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Remove legacy script mode and simplify remaining modes (#13971)
This commit is contained in:
parent
5a4fa2b528
commit
6845a316dd
@ -57,37 +57,30 @@ automation:
|
||||
|
||||
### Automation Modes
|
||||
|
||||
The automation's `mode` configuration option controls what happens when the automation is triggered while the actions are still running from a previous trigger. The default mode is `legacy`.
|
||||
The automation's `mode` configuration option controls what happens when the automation is triggered while the actions are still running from a previous trigger.
|
||||
|
||||
Mode | Description
|
||||
-|-
|
||||
`legacy` | See [below](#legacy-mode).
|
||||
`error` | Raise an error. Previous run continues normally.
|
||||
`ignore` | Do not start a new run. Previous run continues normally.
|
||||
`parallel` | Start a new, independent run in parallel with previous runs which continue normally.
|
||||
`single` | Do not start a new run. Issue a warning.
|
||||
`restart` | Start a new run after first stopping previous run.
|
||||
`queue` | Start a new run after all previous runs complete. Runs are guaranteed to execute in the order they were queued. The maximum number of queued up runs is controlled by the `queue_size` configuration option, which defaults to 10.
|
||||
`queued` | Start a new run after all previous runs complete. Runs are guaranteed to execute in the order they were queued.
|
||||
`parallel` | (Default) Start a new, independent run in parallel with previous runs.
|
||||
|
||||
For both `queued` and `parallel` modes, configuration option `max` controls the maximum
|
||||
number of runs that can be executing and/or queued up at a time. The default is 10.
|
||||
|
||||
#### Example Setting Automation Mode
|
||||
|
||||
```yaml
|
||||
automation:
|
||||
- mode: queue
|
||||
queue_size: 5
|
||||
trigger:
|
||||
...
|
||||
- trigger:
|
||||
- ...
|
||||
mode: queued
|
||||
max: 25
|
||||
action:
|
||||
- ...
|
||||
```
|
||||
|
||||
#### Legacy Mode
|
||||
|
||||
<div class='note'>
|
||||
|
||||
This mode is deprecated, and a warning to that effect will be issued at startup unless `mode: legacy` is specified.
|
||||
|
||||
</div>
|
||||
|
||||
This mode maintains the legacy script behavior. That is, the actions will run until a `delay` step, or a `wait_template` step (that actually waits) is executed, at which point the actions will suspend. If the automation is triggered while the actions are suspended, it will abort the delay/wait_template and continue immediately to the next step, or finish if there are no more steps.
|
||||
|
||||
### Deleting Automations
|
||||
|
||||
When automations remain visible in the Home Assistant Dashboard, even after having deleted in the YAML file, you have to delete them in the UI.
|
||||
|
@ -68,12 +68,12 @@ fields:
|
||||
description: An example value for PARAMETER_NAME.
|
||||
type: string
|
||||
mode:
|
||||
description: "Controls what happens when script is run while it is still running from one or more previous invocations. See [Script Modes](#script-modes)."
|
||||
description: "Controls what happens when script is invoked while it is still running from one or more previous invocations. See [Script Modes](#script-modes)."
|
||||
required: false
|
||||
type: string
|
||||
default: legacy
|
||||
queue_size:
|
||||
description: "Controls maximum number of queued runs waiting for previous run to complete. Only valid with `mode: queue`."
|
||||
default: single
|
||||
max:
|
||||
description: "Controls maximum number of runs executing and/or queued up to run at a time. Only valid with modes `queued` and `parallel`."
|
||||
required: false
|
||||
type: integer
|
||||
default: 10
|
||||
@ -87,27 +87,15 @@ sequence:
|
||||
|
||||
Mode | Description
|
||||
-|-
|
||||
`legacy` | See [below](#legacy-mode).
|
||||
`error` | Raise an error. Previous run continues normally.
|
||||
`ignore` | Do not start a new run. Previous run continues normally.
|
||||
`parallel` | Start a new, independent run in parallel with previous runs which continue normally.
|
||||
`single` | Do not start a new run. Issue a warning.
|
||||
`restart` | Start a new run after first stopping previous run.
|
||||
`queue` | Start a new run after all previous runs complete. Runs are guaranteed to execute in the order they were queued.
|
||||
`queued` | Start a new run after all previous runs complete. Runs are guaranteed to execute in the order they were queued.
|
||||
`parallel` | Start a new, independent run in parallel with previous runs.
|
||||
|
||||
<p class='img'>
|
||||
<img src='/images/integrations/script/script_modes.jpg'>
|
||||
</p>
|
||||
|
||||
#### Legacy Mode
|
||||
|
||||
<div class='note'>
|
||||
|
||||
This mode is deprecated, and a warning to that effect will be issued at startup unless `mode: legacy` is specified.
|
||||
|
||||
</div>
|
||||
|
||||
This mode maintains the legacy script behavior. That is, the script will run until it executes a `delay` step, or a `wait_template` step (that actually waits), at which point the script will suspend. If the script is run while suspended, it will abort the delay/wait_template and continue immediately to the next step, or finish if there are no more steps. Also, calling a legacy script that is still running (and not suspended) will result in an error.
|
||||
|
||||
### Full Configuration
|
||||
|
||||
{% raw %}
|
||||
@ -240,11 +228,3 @@ script:
|
||||
# Do some things at the same time as the first script...
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
Note that this is only guaranteed to work if the called script uses a non-legacy mode.
|
||||
|
||||
### In the Overview
|
||||
|
||||
Legacy scripts in the Overview panel will be displayed with an **EXECUTE** button if the script has no `delay:` or `wait_template:` statement, and as a toggle switch if it has either of those. Scripts configured for any other mode than `legacy` will also be displayed with a toggle switch.
|
||||
|
||||
This is to enable you to stop a running script.
|
||||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 53 KiB |
Loading…
x
Reference in New Issue
Block a user