Skip to content

Commit 26c3ba2

Browse files
authored
[esp32_improv] Doc updates for esphome/esphome#7461 (#4256)
1 parent d1d86cf commit 26c3ba2

File tree

1 file changed

+114
-2
lines changed

1 file changed

+114
-2
lines changed

components/esp32_improv.rst

Lines changed: 114 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,120 @@ Configuration variables:
3737
to be re-authorized. Defaults to ``1min``.
3838
- **status_indicator** (*Optional*, :ref:`config-id`): An :doc:`output <output/index>` to display feedback to the user.
3939
- **identify_duration** (*Optional*, :ref:`config-time`): The amount of time to identify for. Defaults to ``10s``.
40-
- **wifi_timeout** (*Optional*, :ref:`config-time`): The amount of time to wait before starting the improv service after Wi-Fi
41-
is no longer connected. Defaults to ``1min``.
40+
- **wifi_timeout** (*Optional*, :ref:`config-time`): The amount of time to wait before starting the Improv service
41+
after Wi-Fi is no longer connected. Defaults to ``1min``.
42+
- **on_start** (*Optional*, :ref:`Automation<automation>`): An action to be performed when Improv is waiting for
43+
authorization and/or upon authorization. See :ref:`improv-on_start`.
44+
- **on_provisioned** (*Optional*, :ref:`Automation<automation>`): An action to be performed when provisioning has
45+
completed. See :ref:`improv-on_provisioned`.
46+
- **on_provisioning** (*Optional*, :ref:`Automation<automation>`): An action to be performed when the device begins the
47+
provisioning process. See :ref:`improv-on_provisioning`.
48+
- **on_stop** (*Optional*, :ref:`Automation<automation>`): An action to be performed when Improv has stopped.
49+
See :ref:`improv-on_stop`.
50+
- **on_state** (*Optional*, :ref:`Automation<automation>`): An action to be performed when an Improv state change
51+
happens. See :ref:`improv-on_state`.
52+
53+
.. _improv-automations:
54+
55+
Improv Automations
56+
------------------
57+
58+
The ESP32 Improv component provides various :ref:`automations <automation>` that can be used to provide feedback during
59+
the Improv provisioning process.
60+
61+
.. _improv-on_start:
62+
63+
``on_start``
64+
************
65+
66+
This automation will be triggered when the device is waiting for authorization (usually by pressing a button on the
67+
device, if configured -- see ``authorizer`` above) and/or upon authorization.
68+
69+
.. code-block:: yaml
70+
71+
esp32_improv:
72+
on_start:
73+
then:
74+
- logger.log: "Improv awaiting authorization/authorized"
75+
76+
.. _improv-on_provisioned:
77+
78+
``on_provisioned``
79+
******************
80+
81+
This automation will be triggered when provisioning has completed.
82+
83+
.. code-block:: yaml
84+
85+
esp32_improv:
86+
on_provisioned:
87+
then:
88+
- logger.log: "Improv provisioned"
89+
90+
.. _improv-on_provisioning:
91+
92+
``on_provisioning``
93+
*******************
94+
95+
This automation will be triggered when provisioning begins.
96+
97+
.. code-block:: yaml
98+
99+
esp32_improv:
100+
on_provisioning:
101+
then:
102+
- logger.log: "Improv provisioning"
103+
104+
.. _improv-on_stop:
105+
106+
``on_stop``
107+
***********
108+
109+
This automation will be triggered when Improv has stopped.
110+
111+
.. code-block:: yaml
112+
113+
esp32_improv:
114+
on_stop:
115+
then:
116+
- logger.log: "Improv stopped"
117+
118+
.. _improv-on_state:
119+
120+
``on_state``
121+
************
122+
123+
This automation will be triggered on every state change.
124+
125+
Two variables are available for use in :ref:`lambdas<config-lambda>` within this automation. They are:
126+
127+
- ``state``, an ``enum`` named ``improv::State``, having one of the following values:
128+
129+
- ``improv::STATE_STOPPED``
130+
- ``improv::STATE_AWAITING_AUTHORIZATION``
131+
- ``improv::STATE_AUTHORIZED``
132+
- ``improv::STATE_PROVISIONING``
133+
- ``improv::STATE_PROVISIONED``
134+
135+
- ``error``, an ``enum`` named ``improv::Error``, having one of the following values:
136+
137+
- ``improv::ERROR_NONE``
138+
- ``improv::ERROR_INVALID_RPC``
139+
- ``improv::ERROR_UNKNOWN_RPC``
140+
- ``improv::ERROR_UNABLE_TO_CONNECT``
141+
- ``improv::ERROR_NOT_AUTHORIZED``
142+
- ``improv::ERROR_UNKNOWN``
143+
144+
.. code-block:: yaml
145+
146+
esp32_improv:
147+
on_state:
148+
then:
149+
- if:
150+
condition:
151+
lambda: return state == improv::STATE_AUTHORIZED;
152+
then:
153+
- logger.log: "Improv state is STATE_AUTHORIZED"
42154
43155
Status Indicator
44156
----------------

0 commit comments

Comments
 (0)