mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-02-02 23:31:30 +01:00
Add initial_run to regular lambda effect (#1806)
This commit is contained in:
parent
16cdfe44dc
commit
021272ecee
@ -405,10 +405,10 @@ with the behavior of the ``light.is_on`` and ``light.is_off`` condition above.
|
|||||||
``light.on_state`` Trigger
|
``light.on_state`` Trigger
|
||||||
**************************
|
**************************
|
||||||
|
|
||||||
This trigger is activated each time the set light state is changed. It is not triggered
|
This trigger is activated each time the set light state is changed. It is not triggered
|
||||||
based on current state, but rather, it triggers on the set state which can differ from
|
based on current state, but rather, it triggers on the set state which can differ from
|
||||||
the current state due to transitions. For example, the ``light.on_state`` trigger can
|
the current state due to transitions. For example, the ``light.on_state`` trigger can
|
||||||
be used for immediate action when the light is set to off; while ``light.on_turn_off``
|
be used for immediate action when the light is set to off; while ``light.on_turn_off``
|
||||||
does not trigger until the light actually achieves the off state.
|
does not trigger until the light actually achieves the off state.
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
@ -586,6 +586,10 @@ Lambda Effect
|
|||||||
|
|
||||||
This effect allows you to write completely custom light effects yourself using :ref:`lambdas <config-lambda>`.
|
This effect allows you to write completely custom light effects yourself using :ref:`lambdas <config-lambda>`.
|
||||||
|
|
||||||
|
Available variable in the lambda:
|
||||||
|
|
||||||
|
- **initial_run** - A bool which is true on the first execution of the lambda. Useful to reset static variables when restarting an effect.
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
light:
|
light:
|
||||||
@ -622,6 +626,7 @@ Configuration variables:
|
|||||||
- **lambda** (**Required**, :ref:`lambda <config-lambda>`): The code to execute. ``static`` variables are
|
- **lambda** (**Required**, :ref:`lambda <config-lambda>`): The code to execute. ``static`` variables are
|
||||||
especially useful.
|
especially useful.
|
||||||
|
|
||||||
|
|
||||||
Addressable Rainbow Effect
|
Addressable Rainbow Effect
|
||||||
**************************
|
**************************
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user