mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-12-26 17:27:47 +01:00
Add cover toggle support (#1189)
* Add cover toggle support Step through open/stop/close/stop sequence with every toggle * Tweak Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
b40fe3ca16
commit
c60b571a4b
@ -110,6 +110,31 @@ This :ref:`action <config-action>` stops the cover with the given ID when execut
|
|||||||
call.set_command_stop();
|
call.set_command_stop();
|
||||||
call.perform();
|
call.perform();
|
||||||
|
|
||||||
|
.. _cover-toggle_action:
|
||||||
|
|
||||||
|
``cover.toggle`` Action
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
This :ref:`action <config-action>` toggles the cover with the given ID when executed,
|
||||||
|
cycling through the states close/stop/open/stop... This allows the cover to be controlled
|
||||||
|
by a single push button.
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
on_...:
|
||||||
|
then:
|
||||||
|
- cover.toggle: cover_1
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This action can also be expressed in :ref:`lambdas <config-lambda>`:
|
||||||
|
|
||||||
|
.. code-block:: cpp
|
||||||
|
|
||||||
|
auto call = id(cover_1).make_call();
|
||||||
|
call.set_command_toggle();
|
||||||
|
call.perform();
|
||||||
|
|
||||||
.. _cover-control_action:
|
.. _cover-control_action:
|
||||||
|
|
||||||
``cover.control`` Action
|
``cover.control`` Action
|
||||||
|
Loading…
Reference in New Issue
Block a user