From 168220b878c59c139b233d7e06672bfb0fbd2a34 Mon Sep 17 00:00:00 2001 From: Gabriel Sieben Date: Tue, 12 Jul 2022 23:53:40 +0200 Subject: [PATCH] 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. --- guides/automations.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/guides/automations.rst b/guides/automations.rst index fb457796b..a6f94ee96 100644 --- a/guides/automations.rst +++ b/guides/automations.rst @@ -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