Skip to content

Commit f257f2b

Browse files
authored
Merge branch 'next' into ap-condition
2 parents 4e17ef0 + 7cf6fa3 commit f257f2b

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

content/components/select/_index.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ MQTT Options:
6565
## Select Automation
6666

6767
You can access the most recent state of the select in [lambdas](/automations/templates#config-lambda) using
68-
`id(select_id).state`.
68+
`id(select_id).current_option()`.
6969
For more information on using lambdas with select, see [lambda calls](#select-lambda_calls).
7070

7171
{{< anchor "select-on_value" >}}
@@ -268,19 +268,28 @@ advanced stuff (see the full API Reference for more info).
268268
to select the first option or `call.select_next(true)` to select the next
269269
option with the cycle feature enabled.
270270

271-
- `.state` : Retrieve the currently selected option of the select.
271+
- `.current_option()` : Retrieve the currently selected option of the select. Returns `const char*`.
272272

273273
```cpp
274274
// For example, create a custom log message when an option is selected:
275-
auto state = id(my_select).state.c_str();
275+
auto state = id(my_select).current_option();
276276
ESP_LOGI("main", "Option of my select: %s", state);
277277
```
278278

279279
```yaml
280-
# Check if a specific option is selected
280+
# Check if a specific option is selected (using strcmp)
281281
- if:
282282
condition:
283-
- lambda: 'return id(my_select).state == "my_option_value";'
283+
- lambda: 'return strcmp(id(my_select).current_option(), "my_option_value") == 0;'
284+
```
285+
286+
```yaml
287+
# Or convert to std::string for comparison
288+
- if:
289+
condition:
290+
- lambda: |-
291+
std::string current = id(my_select).current_option();
292+
return current == "my_option_value";
284293
```
285294

286295
- `.size()` : Retrieve the number of options in the select.

content/components/select/template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ select:
5050
- All other options from [Select](/components/select#config-select).
5151

5252
> [!NOTE]
53-
> If you don't set a `lambda` and `optimistic` is `false` (default), updates to the select component state will need to be taken care of as part of your `set_action` using `id(my_select).publish_state(x);` (in a lambda). Do not use [`select.set` Action](/components/select#select-set_action) here, as this would generate a loop. Also, don't use `id(my_select).state = x` as this won't have the desired effect (e.g. HA won't update with the change).
53+
> If you don't set a `lambda` and `optimistic` is `false` (default), updates to the select component state will need to be taken care of as part of your `set_action` using `id(my_select).publish_state(x);` (in a lambda). Do not use [`select.set` Action](/components/select#select-set_action) here, as this would generate a loop.
5454

5555
## `select.set` Action
5656

content/components/time/rx8130.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ time:
7777
# repeated synchronization is not necessary unless the external RTC
7878
# is much more accurate than the internal clock
7979
update_interval: never
80+
timezone: Europe/Paris
8081
- platform: homeassistant
8182
# instead try to synchronize via network repeatedly ...
8283
on_time_sync:

0 commit comments

Comments
 (0)