Update index.rst (#3645)

Explanation for how to check if the select has a specific value selected. This is very difficult to find/deduce from the documentation.
This commit is contained in:
Zynth-dev 2024-02-27 20:47:11 +01:00 committed by GitHub
parent b8e58d401d
commit a49bc0140e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -281,6 +281,14 @@ advanced stuff (see the full API Reference for more info).
auto state = id(my_select).state.c_str();
ESP_LOGI("main", "Option of my select: %s", state);
.. code-block:: yaml
# Check if a specific option is selected
- if:
condition:
- lambda: 'return id(my_select).state == "my_option_value";'
- ``.size()``: Retrieve the number of options in the select.
.. code-block:: cpp