Add note explaining what to do in set_action (#2585)

Add note explaining what to do in set_action to update the state of the component.
This commit is contained in:
Antonio Fiol 2023-01-11 09:51:27 +01:00 committed by GitHub
parent bc0c9aa286
commit 7697877195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,10 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. - **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Select <config-select>`. - All other options from :ref:`Select <config-select>`.
.. note::
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 :ref:`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).
``select.set`` Action ``select.set`` Action
--------------------- ---------------------