scripts: rename 'service' to 'action' (#33790)

This commit is contained in:
c0ffeeca7 2024-07-16 15:17:23 +02:00 committed by GitHub
parent 86d7fa07c6
commit 3379638eaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,9 +33,9 @@ script:
{{ page.content | markdownify | toc_only }}
## Call a service
## Perform an action
The most important one is the action to call a {% term service %}. This can be done in various ways. For all the different possibilities, have a look at the [service calls page].
Performing an action can be done in various ways. For all the different possibilities, have a look at the [actions page].
```yaml
- alias: "Bedroom lights on"
@ -48,7 +48,7 @@ The most important one is the action to call a {% term service %}. This can be d
### Activate a scene
Scripts may also use a shortcut syntax for activating {% term scenes %} instead of calling the `scene.turn_on` service.
Scripts may also use a shortcut syntax for activating {% term scenes %} instead of calling the `scene.turn_on` action.
```yaml
- scene: scene.morning_living_room
@ -280,11 +280,11 @@ Without `continue_on_timeout: false` the script will always continue since the d
After each time a wait completes, either because the condition was met, the event happened, or the timeout expired, the variable `wait` will be created/updated to indicate the result.
Variable | Description
-|-
`wait.completed` | Exists only after `wait_template`. `true` if the condition was met, `false` otherwise
`wait.trigger` | Exists only after `wait_for_trigger`. Contains information about which trigger fired. (See [Available-Trigger-Data](/docs/automation/templating/#available-trigger-data).) Will be `none` if no trigger happened before timeout expired
`wait.remaining` | Timeout remaining, or `none` if a timeout was not specified
| Variable | Description |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `wait.completed` | Exists only after `wait_template`. `true` if the condition was met, `false` otherwise |
| `wait.trigger` | Exists only after `wait_for_trigger`. Contains information about which trigger fired. (See [Available-Trigger-Data](/docs/automation/templating/#available-trigger-data).) Will be `none` if no trigger happened before timeout expired |
| `wait.remaining` | Timeout remaining, or `none` if a timeout was not specified |
This can be used to take different actions based on whether or not the condition was met, or to use more than one wait sequentially while implementing a single timeout overall.
@ -570,11 +570,11 @@ For example:
A variable named `repeat` is defined within the repeat {% term action %} (i.e., it is available inside `sequence`, `while` & `until`.)
It contains the following fields:
field | description
-|-
`first` | True during the first iteration of the repeat sequence
`index` | The iteration number of the loop: 1, 2, 3, ...
`last` | True during the last iteration of the repeat sequence, which is only valid for counted loops
| field | description |
| ------- | -------------------------------------------------------------------------------------------- |
| `first` | True during the first iteration of the repeat sequence |
| `index` | The iteration number of the loop: 1, 2, 3, ... |
| `last` | True during the last iteration of the repeat sequence, which is only valid for counted loops |
## If-then
@ -902,8 +902,8 @@ By default, a sequence of {% term actions %} will be halted when one of the {% t
that sequence encounters an error. The {% term automation %} or script will be halted,
an error is logged, and the {% term automation %} or script run is marked as errored.
Sometimes these errors are expected, for example, because you know the service
you call can be problematic at times, and it doesn't matter if it fails.
Sometimes these errors are expected, for example, because you know the action
you perform can be problematic at times, and it doesn't matter if it fails.
You can set `continue_on_error` for those cases on such an {% term action %}.
The `continue_on_error` is available on all {% term actions %} and is set to
@ -1007,7 +1007,7 @@ will not be used by anything.
[Script integration]: /integrations/script/
[automations]: /docs/automation/action/
[Alexa/Amazon Echo]: /integrations/alexa/
[service calls page]: /docs/scripts/service-calls/
[actions page]: /docs/scripts/service-calls/
[conditions page]: /docs/scripts/conditions/
[shorthand-template]: /docs/scripts/conditions/#template-condition-shorthand-notation
[script variables]: /integrations/script/#configuration-variables