mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-10-31 08:31:29 +01:00
Add triggers on_turn_on / on_turn_off (#1116)
This commit is contained in:
parent
1f095957d4
commit
db09f74caf
@ -45,6 +45,13 @@ MQTT options:
|
||||
speed commands on.
|
||||
- All other options from :ref:`MQTT Component <config-mqtt-component>`.
|
||||
|
||||
Automation triggers:
|
||||
|
||||
- **on_turn_on** (*Optional*, :ref:`Action <config-action>`): An automation to perform
|
||||
when the fan is turned on. See :ref:`fan-on_turn_on_off_trigger`.
|
||||
- **on_turn_off** (*Optional*, :ref:`Action <config-action>`): An automation to perform
|
||||
when the fan is turned off. See :ref:`fan-on_turn_on_off_trigger`.
|
||||
|
||||
.. _fan-toggle_action:
|
||||
|
||||
``fan.toggle`` Action
|
||||
@ -95,6 +102,24 @@ Configuration options:
|
||||
- **speed** (*Optional*, int, :ref:`templatable <config-templatable>`):
|
||||
Set the speed level of the fan. Can be a number between 1 and the maximum speed level of the fan.
|
||||
|
||||
.. _fan-on_turn_on_off_trigger:
|
||||
|
||||
``fan.on_turn_on`` / ``fan.on_turn_off`` Trigger
|
||||
****************************************************
|
||||
|
||||
This trigger is activated each time the fan is turned on or off. It does not fire
|
||||
if a command to turn the fan on or off already matches the current state.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
fan:
|
||||
- platform: speed # or any other platform
|
||||
# ...
|
||||
on_turn_on:
|
||||
- logger.log: "Fan Turned On!"
|
||||
on_turn_off:
|
||||
- logger.log: "Fan Turned Off!"
|
||||
|
||||
Full Fan Index
|
||||
--------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user