Skip to content

Commit 2112525

Browse files
moallemifabaff
authored andcommitted
Add documentation for set_options service call (home-assistant#3292)
* Add documentation for set_options service call * Minor changes
1 parent 3d26a4f commit 2112525

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

source/_components/input_select.markdown

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Configuration variables:
3737
3838
- **[alias]** array (*Required*): Alias for the input. Multiple entries are allowed..
3939
- **name** (*Optional*): Friendly name of the input.
40-
- **options** array (*Required*): List of options to choose from.
40+
- **options** array (*Required*): List of options to choose from.
4141
- **initial** (*Optional*): Initial value when Home Assistant starts.
4242
- **icon** (*Optional*): Icon for entry.
4343
@@ -71,6 +71,22 @@ automation:
7171
option: Paulus
7272
```
7373

74+
To dynamically set the `input_select` options you can call `input_select.set_options`. The following example can be used in an automation rule:
75+
76+
```yaml
77+
# Example configuration.yaml entry
78+
automation:
79+
- alias: example automation
80+
trigger:
81+
platform: event
82+
event_type: MY_CUSTOM_EVENT
83+
action:
84+
- service: input_select.set_options
85+
data:
86+
entity_id: input_select.who_cooks
87+
options: ["Item A", "Item B", "Item C"]
88+
```
89+
7490
### {% linkable_title Scenes %}
7591

7692
To specify a target option in a [Scene](/components/scene/) you have to specify the target as `option` attribute:

0 commit comments

Comments
 (0)