mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 07:17:14 +00:00
scripts: rename 'service' to 'action' (#33790)
This commit is contained in:
parent
86d7fa07c6
commit
3379638eaf
@ -33,9 +33,9 @@ script:
|
|||||||
|
|
||||||
{{ page.content | markdownify | toc_only }}
|
{{ 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
|
```yaml
|
||||||
- alias: "Bedroom lights on"
|
- 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
|
### 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
|
```yaml
|
||||||
- scene: scene.morning_living_room
|
- 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.
|
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
|
| Variable | Description |
|
||||||
-|-
|
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
`wait.completed` | Exists only after `wait_template`. `true` if the condition was met, `false` otherwise
|
| `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.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
|
| `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.
|
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`.)
|
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:
|
It contains the following fields:
|
||||||
|
|
||||||
field | description
|
| field | description |
|
||||||
-|-
|
| ------- | -------------------------------------------------------------------------------------------- |
|
||||||
`first` | True during the first iteration of the repeat sequence
|
| `first` | True during the first iteration of the repeat sequence |
|
||||||
`index` | The iteration number of the loop: 1, 2, 3, ...
|
| `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
|
| `last` | True during the last iteration of the repeat sequence, which is only valid for counted loops |
|
||||||
|
|
||||||
## If-then
|
## 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,
|
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.
|
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
|
Sometimes these errors are expected, for example, because you know the action
|
||||||
you call can be problematic at times, and it doesn't matter if it fails.
|
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 %}.
|
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
|
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/
|
[Script integration]: /integrations/script/
|
||||||
[automations]: /docs/automation/action/
|
[automations]: /docs/automation/action/
|
||||||
[Alexa/Amazon Echo]: /integrations/alexa/
|
[Alexa/Amazon Echo]: /integrations/alexa/
|
||||||
[service calls page]: /docs/scripts/service-calls/
|
[actions page]: /docs/scripts/service-calls/
|
||||||
[conditions page]: /docs/scripts/conditions/
|
[conditions page]: /docs/scripts/conditions/
|
||||||
[shorthand-template]: /docs/scripts/conditions/#template-condition-shorthand-notation
|
[shorthand-template]: /docs/scripts/conditions/#template-condition-shorthand-notation
|
||||||
[script variables]: /integrations/script/#configuration-variables
|
[script variables]: /integrations/script/#configuration-variables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user