Add triggers on_turn_on / on_turn_off (#1116)

This commit is contained in:
Anthony Uk 2021-05-19 06:12:59 +02:00 committed by GitHub
parent 1f095957d4
commit db09f74caf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -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
--------------