mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-26 17:27:47 +01:00
lambda example in the script section
I have included examples of 'lambda' in the "script" section. I played around for ages until I noticed that the round clamps at the end were missing. In the forum also searched someone who did not get an answer to his question. It will help others.
This commit is contained in:
parent
39cd2b5fa7
commit
168220b878
@ -723,6 +723,12 @@ script was already running.
|
||||
then:
|
||||
- script.execute: my_script
|
||||
|
||||
or as lambda
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
lambda: 'id(my_script).execute();
|
||||
|
||||
.. _script-stop_action:
|
||||
|
||||
``script.stop`` Action
|
||||
@ -750,6 +756,13 @@ will not be executed.
|
||||
then:
|
||||
- script.stop: my_script
|
||||
|
||||
or as lambda
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
lambda: 'id(my_script).stop();'
|
||||
|
||||
|
||||
.. _script-wait_action:
|
||||
|
||||
``script.wait`` Action
|
||||
@ -776,6 +789,14 @@ of the script are running in parallel, this will block until all of them have te
|
||||
- script.execute: my_script
|
||||
- script.wait: my_script
|
||||
|
||||
or as lambda
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
lambda: |-
|
||||
id(my_script).execute();
|
||||
id(my_script).wait();
|
||||
|
||||
.. _script-is_running_condition:
|
||||
|
||||
``script.is_running`` Condition
|
||||
@ -794,6 +815,15 @@ of the given id is running, not how many.
|
||||
then:
|
||||
- logger.log: Script is running!
|
||||
|
||||
or as lambda
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
lambda: -|
|
||||
if(id(my_script).is_running() {
|
||||
ESP_LOGI("main", "Script is running!");
|
||||
}
|
||||
|
||||
.. _for_condition:
|
||||
|
||||
``for`` Condition
|
||||
|
Loading…
Reference in New Issue
Block a user