From 168220b878c59c139b233d7e06672bfb0fbd2a34 Mon Sep 17 00:00:00 2001 From: Gabriel Sieben Date: Tue, 12 Jul 2022 23:53:40 +0200 Subject: [PATCH 1/4] 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 From 3b3f506a9f0565c94baa70d402231574dd7be177 Mon Sep 17 00:00:00 2001 From: Gabriel Sieben Date: Wed, 13 Jul 2022 00:05:26 +0200 Subject: [PATCH 2/4] Update automations.rst --- guides/automations.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guides/automations.rst b/guides/automations.rst index a6f94ee96..8cb240a4b 100644 --- a/guides/automations.rst +++ b/guides/automations.rst @@ -760,6 +760,7 @@ or as lambda .. code-block:: yaml + lambda: 'id(my_script).stop();' @@ -791,6 +792,7 @@ of the script are running in parallel, this will block until all of them have te or as lambda + .. code-block:: yaml lambda: |- From c0afd8dfefbc98600c6744533f621345ae5565b5 Mon Sep 17 00:00:00 2001 From: Gabriel Sieben Date: Wed, 20 Jul 2022 12:10:05 +0200 Subject: [PATCH 3/4] Update automations.rst there were illegal blanks in the new line after the code block --- guides/automations.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/guides/automations.rst b/guides/automations.rst index 8cb240a4b..ebb62c996 100644 --- a/guides/automations.rst +++ b/guides/automations.rst @@ -727,7 +727,7 @@ or as lambda .. code-block:: yaml - lambda: 'id(my_script).execute(); + lambda: 'id(my_script).execute(); .. _script-stop_action: @@ -758,11 +758,9 @@ will not be executed. or as lambda -.. code-block:: yaml - - - lambda: 'id(my_script).stop();' +.. code-block:: yaml + lambda: 'id(my_script).stop();' .. _script-wait_action: @@ -792,9 +790,8 @@ of the script are running in parallel, this will block until all of them have te or as lambda - .. code-block:: yaml - + lambda: |- id(my_script).execute(); id(my_script).wait(); From d31494a9b0f0432c1bfdbf0122e8fc242e3541cc Mon Sep 17 00:00:00 2001 From: Gabriel Sieben Date: Wed, 20 Jul 2022 12:16:26 +0200 Subject: [PATCH 4/4] Update automations.rst --- guides/automations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/automations.rst b/guides/automations.rst index ebb62c996..4ab0c48b5 100644 --- a/guides/automations.rst +++ b/guides/automations.rst @@ -727,7 +727,7 @@ or as lambda .. code-block:: yaml - lambda: 'id(my_script).execute(); + lambda: 'id(my_script).execute(); .. _script-stop_action: