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:
Gabriel Sieben 2022-07-12 23:53:40 +02:00 committed by GitHub
parent 39cd2b5fa7
commit 168220b878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -723,6 +723,12 @@ script was already running.
then: then:
- script.execute: my_script - script.execute: my_script
or as lambda
.. code-block:: yaml
lambda: 'id(my_script).execute();
.. _script-stop_action: .. _script-stop_action:
``script.stop`` Action ``script.stop`` Action
@ -750,6 +756,13 @@ will not be executed.
then: then:
- script.stop: my_script - script.stop: my_script
or as lambda
.. code-block:: yaml
lambda: 'id(my_script).stop();'
.. _script-wait_action: .. _script-wait_action:
``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.execute: my_script
- script.wait: 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:
``script.is_running`` Condition ``script.is_running`` Condition
@ -794,6 +815,15 @@ of the given id is running, not how many.
then: then:
- logger.log: Script is running! - 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:
``for`` Condition ``for`` Condition