Add documentation for set_options service call (#3292)

* Add documentation for set_options service call

* Minor changes
This commit is contained in:
Reza Moallemi 2017-09-02 15:21:53 +04:30 committed by Fabian Affolter
parent 3d26a4f893
commit 2112525d2a

View File

@ -37,7 +37,7 @@ Configuration variables:
- **[alias]** array (*Required*): Alias for the input. Multiple entries are allowed.. - **[alias]** array (*Required*): Alias for the input. Multiple entries are allowed..
- **name** (*Optional*): Friendly name of the input. - **name** (*Optional*): Friendly name of the input.
- **options** array (*Required*): List of options to choose from. - **options** array (*Required*): List of options to choose from.
- **initial** (*Optional*): Initial value when Home Assistant starts. - **initial** (*Optional*): Initial value when Home Assistant starts.
- **icon** (*Optional*): Icon for entry. - **icon** (*Optional*): Icon for entry.
@ -71,6 +71,22 @@ automation:
option: Paulus option: Paulus
``` ```
To dynamically set the `input_select` options you can call `input_select.set_options`. The following example can be used in an automation rule:
```yaml
# Example configuration.yaml entry
automation:
- alias: example automation
trigger:
platform: event
event_type: MY_CUSTOM_EVENT
action:
- service: input_select.set_options
data:
entity_id: input_select.who_cooks
options: ["Item A", "Item B", "Item C"]
```
### {% linkable_title Scenes %} ### {% linkable_title Scenes %}
To specify a target option in a [Scene](/components/scene/) you have to specify the target as `option` attribute: To specify a target option in a [Scene](/components/scene/) you have to specify the target as `option` attribute: