Document variables for scripts/automations (#14458)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Paulus Schoutsen 2020-09-10 20:44:19 +02:00 committed by GitHub
parent 3c67c58e48
commit 1019b852a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View File

@ -9,7 +9,7 @@ module Jekyll
TYPES = [
'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

View File

@ -22,15 +22,18 @@ automation:
entity_id:
- light.kitchen
- light.living_room
automation 2:
# Notify me on my mobile phone of an event
trigger:
platform: sun
event: sunset
offset: -00:30
variables:
notification_service: notify.paulus_iphone
action:
# Actions are scripts so can also be a list of actions
- service: notify.notify
- service: {{ notification_service }}
data:
message: Beautiful sunset!
- delay: 0:35

View File

@ -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/).
{% raw %}
```yaml
# Example configuration.yaml entry
script:
@ -51,6 +51,15 @@ description:
required: false
default: ''
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:
description: Information about the parameters that the script uses; see the [Passing variables to scripts](#passing-variables-to-scripts) section below.
required: false
@ -111,6 +120,8 @@ script: 
alias: Wake Up
icon: "mdi:party-popper"
description: 'Turns on the bedroom lights and then the living room lights after a delay'
variables:
turn_on_entity: group.living_room
fields:
minutes:
description: 'The amount of time to wait before turning on the living room lights'
@ -136,7 +147,7 @@ script: 
- alias: Living room lights on
service: light.turn_on
data:
entity_id: group.living_room
entity_id: {{ turn_on_entity }}
```
{% endraw %}