Skip to content

Commit d1e11a1

Browse files
authored
Document new select entity services (home-assistant#26092)
1 parent 12234fc commit d1e11a1

File tree

1 file changed

+122
-5
lines changed

1 file changed

+122
-5
lines changed

source/_integrations/select.markdown

Lines changed: 122 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,127 @@ Keeps track on `select` entities in your environment, their state, and allows
1515
you to control them. This integration allows other integrations to offer
1616
a limited set of selectable options for the entity.
1717

18-
### Services
18+
## Services
1919

20-
The Select entities registers the following services:
20+
The select entity exposes additional to control the entity in, for example,
21+
automation or scripts. These service can be created via the UI, but are
22+
also available in YAML (for which examples are provided below).
2123

22-
| Service | Data | Description |
23-
| ------- | ---- | ----------- |
24-
| `select_option` | `option`<br>`entity_id(s)`<br>`area_id(s)` | Set the current select option of specific `select` entities
24+
### Service `select.select_first`
25+
26+
The {% my developer_call_service service="select.select_first" %} service
27+
changes the selected option of the select entity to the first option in the
28+
list of options available.
29+
30+
This service does not have additional options.
31+
32+
{% my developer_call_service badge service="select.select_first" %}
33+
34+
An example in YAML:
35+
36+
```yaml
37+
service: select.select_first
38+
target:
39+
entity_id: select.my_entity
40+
```
41+
42+
### Service `select.select_last`
43+
44+
The {% my developer_call_service service="select.select_last" %} service changes
45+
the selected option of the select entity to the last option in the list of
46+
options available.
47+
48+
This service does not have additional options.
49+
50+
{% my developer_call_service badge service="select.select_last" %}
51+
52+
An example in YAML:
53+
54+
```yaml
55+
service: select.select_last
56+
target:
57+
entity_id: select.my_entity
58+
```
59+
60+
### Service `select.select_next`
61+
62+
The {% my developer_call_service service="select.select_next" %} service changes
63+
the selected option of the select entity to the next option in the list of
64+
options available. If the current select option is unknown, the first option
65+
in the list is selected instead.
66+
67+
In case the current select option is the last option in the list, it will by
68+
default, cycle back the first option and select that one instead. This cycle
69+
behavior can be disabled by setting the `cycle` option to `false` in the
70+
service call data.
71+
72+
{% my developer_call_service badge service="select.select_next" %}
73+
74+
Examples in YAML:
75+
76+
```yaml
77+
service: select.select_next
78+
target:
79+
entity_id: select.my_entity
80+
```
81+
82+
```yaml
83+
# Disable cycling back to the first option
84+
service: select.select_next
85+
target:
86+
entity_id: select.my_entity
87+
data:
88+
cycle: false
89+
```
90+
91+
### Service `select.select_option`
92+
93+
The {% my developer_call_service service="select.select_option" %} service
94+
changes the selected option to a specific desired option provided in the
95+
service call using the required `option` service call data.
96+
97+
The service call wil not succeed if the selected option is not available in
98+
the list of options for the targeted entity.
99+
100+
{% my developer_call_service badge service="select.select_option" %}
101+
102+
An example in YAML:
103+
104+
```yaml
105+
service: select.select_option
106+
target:
107+
entity_id: select.my_entity
108+
data:
109+
option: "example_option"
110+
```
111+
112+
### Service `select.select_previous`
113+
114+
The {% my developer_call_service service="select.select_previous" %} service
115+
changes the selected option of the select entity to the previous option in the
116+
list of options available. If the current select option is unknown, the
117+
last option in the list is selected instead.
118+
119+
In case the current select option is the first option in the list, it will by
120+
default, cycle back the last option and select that one instead. This cycle
121+
behavior can be disabled by setting the `cycle` option to `false` in the
122+
service call data.
123+
124+
{% my developer_call_service badge service="select.select_previous" %}
125+
126+
Examples in YAML:
127+
128+
```yaml
129+
service: select.select_previous
130+
target:
131+
entity_id: select.my_entity
132+
```
133+
134+
```yaml
135+
# Disable cycling back to the last option
136+
service: select.select_previous
137+
target:
138+
entity_id: select.my_entity
139+
data:
140+
cycle: false
141+
```

0 commit comments

Comments
 (0)