mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-26 17:27:47 +01:00
Merge pull request #2180 from gsieben/patch-5
lambda example in the script section
This commit is contained in:
commit
35685b76a4
@ -730,6 +730,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
|
||||||
@ -757,6 +763,12 @@ 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
|
||||||
@ -783,6 +795,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
|
||||||
@ -801,6 +821,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
|
||||||
|
Loading…
Reference in New Issue
Block a user