From a49bc0140e5d3f9a35ce25f8de546ed16e4f2670 Mon Sep 17 00:00:00 2001 From: Zynth-dev <44590222+Zynth-dev@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:47:11 +0100 Subject: [PATCH] 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. --- components/select/index.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/select/index.rst b/components/select/index.rst index dc6b43063..756964340 100644 --- a/components/select/index.rst +++ b/components/select/index.rst @@ -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