mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-22 16:56:50 +00:00
Document variables for scripts/automations (#14458)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
3c67c58e48
commit
1019b852a0
@ -9,7 +9,7 @@ module Jekyll
|
|||||||
|
|
||||||
TYPES = [
|
TYPES = [
|
||||||
'action', 'boolean', 'string', 'integer', 'float', 'time', 'template',
|
'action', 'boolean', 'string', 'integer', 'float', 'time', 'template',
|
||||||
'device_class', 'icon', 'map', 'list', 'date', 'datetime'
|
'device_class', 'icon', 'map', 'list', 'date', 'datetime', 'any'
|
||||||
]
|
]
|
||||||
|
|
||||||
MIN_DEFAULT_LENGTH = 30
|
MIN_DEFAULT_LENGTH = 30
|
||||||
|
@ -22,15 +22,18 @@ automation:
|
|||||||
entity_id:
|
entity_id:
|
||||||
- light.kitchen
|
- light.kitchen
|
||||||
- light.living_room
|
- light.living_room
|
||||||
|
|
||||||
automation 2:
|
automation 2:
|
||||||
# Notify me on my mobile phone of an event
|
# Notify me on my mobile phone of an event
|
||||||
trigger:
|
trigger:
|
||||||
platform: sun
|
platform: sun
|
||||||
event: sunset
|
event: sunset
|
||||||
offset: -00:30
|
offset: -00:30
|
||||||
|
variables:
|
||||||
|
notification_service: notify.paulus_iphone
|
||||||
action:
|
action:
|
||||||
# Actions are scripts so can also be a list of actions
|
# Actions are scripts so can also be a list of actions
|
||||||
- service: notify.notify
|
- service: {{ notification_service }}
|
||||||
data:
|
data:
|
||||||
message: Beautiful sunset!
|
message: Beautiful sunset!
|
||||||
- delay: 0:35
|
- delay: 0:35
|
||||||
|
@ -17,7 +17,7 @@ The `script` integration allows users to specify a sequence of actions to be exe
|
|||||||
The sequence of actions is specified using the [Home Assistant Script Syntax](/getting-started/scripts/).
|
The sequence of actions is specified using the [Home Assistant Script Syntax](/getting-started/scripts/).
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
script:
|
script:
|
||||||
@ -51,6 +51,15 @@ description:
|
|||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
type: string
|
type: string
|
||||||
|
variables:
|
||||||
|
description: Variables that will be available inside your templates
|
||||||
|
required: false
|
||||||
|
default: {}
|
||||||
|
type: map
|
||||||
|
keys:
|
||||||
|
PARAMETER_NAME:
|
||||||
|
description: The value of the variable. Any YAML is valid.
|
||||||
|
type: any
|
||||||
fields:
|
fields:
|
||||||
description: Information about the parameters that the script uses; see the [Passing variables to scripts](#passing-variables-to-scripts) section below.
|
description: Information about the parameters that the script uses; see the [Passing variables to scripts](#passing-variables-to-scripts) section below.
|
||||||
required: false
|
required: false
|
||||||
@ -111,6 +120,8 @@ script:
|
|||||||
alias: Wake Up
|
alias: Wake Up
|
||||||
icon: "mdi:party-popper"
|
icon: "mdi:party-popper"
|
||||||
description: 'Turns on the bedroom lights and then the living room lights after a delay'
|
description: 'Turns on the bedroom lights and then the living room lights after a delay'
|
||||||
|
variables:
|
||||||
|
turn_on_entity: group.living_room
|
||||||
fields:
|
fields:
|
||||||
minutes:
|
minutes:
|
||||||
description: 'The amount of time to wait before turning on the living room lights'
|
description: 'The amount of time to wait before turning on the living room lights'
|
||||||
@ -136,7 +147,7 @@ script:
|
|||||||
- alias: Living room lights on
|
- alias: Living room lights on
|
||||||
service: light.turn_on
|
service: light.turn_on
|
||||||
data:
|
data:
|
||||||
entity_id: group.living_room
|
entity_id: {{ turn_on_entity }}
|
||||||
```
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user