mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-01-13 20:11:53 +01:00
Add priority to on_shutdown trigger. (#2189)
This commit is contained in:
parent
475933a41f
commit
72b7346128
@ -115,17 +115,26 @@ too many WiFi/MQTT connection attempts, Over-The-Air updates being applied or th
|
|||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
It's not guaranteed that all components are in a connected state when this automation is triggered. For
|
It's not guaranteed that all components are in a connected state when this automation is triggered. For
|
||||||
example, the MQTT client may have already disconnected.
|
example, the MQTT client may have already disconnected. For use-cases that require specific shutdown ordering, look at the ``priority`` parameter.
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
# ...
|
# ...
|
||||||
on_shutdown:
|
on_shutdown:
|
||||||
|
priority: 700
|
||||||
then:
|
then:
|
||||||
- switch.turn_off: switch_1
|
- switch.turn_off: switch_1
|
||||||
|
|
||||||
Configuration variables: See :ref:`Automation <automation>`.
|
Configuration variables:
|
||||||
|
|
||||||
|
- **priority** (*Optional*, float): The priority to execute your custom shutdown code. A higher value
|
||||||
|
means a high priority and in case of shutdown triggers that the code is executed **later**.
|
||||||
|
Priority is used primarily for the initialization order of components. Shutdowns for these components are handled in *reverse* order, such that e.g. sensors (600) are shutdown before the hardware components (800) they depend on.
|
||||||
|
Please note this is an ESPHome-internal value and any change will not be marked as a breaking change.
|
||||||
|
Defaults to ``600``. For priority values refer to the list in the :ref:`esphome-on_boot` section.
|
||||||
|
|
||||||
|
- See :ref:`Automation <automation>`.
|
||||||
|
|
||||||
.. _esphome-on_loop:
|
.. _esphome-on_loop:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user