Skip to content

Commit 5688515

Browse files
nielsnl68Copilotjesserockz
authored
Update espnow documentation (#5207)
Co-authored-by: Copilot <[email protected]> Co-authored-by: Jesse Hills <[email protected]>
1 parent 987e935 commit 5688515

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

components/espnow.rst

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ Configuration variables:
3333
Automations:
3434

3535
- **on_receive** (*Optional*, :ref:`Automation <automation>`): An automation to perform when data is received. See :ref:`espnow-on_receive`.
36-
- **on_unknown_peer** (*Optional*, :ref:`Automation <automation>`): An automation to perform when data is received from an unknown peer.
37-
Cannot be used when ``auto_add_peer`` is set to ``true``. See :ref:`espnow-on_unknown_peer`.
36+
- **on_unknown_peer** (*Optional*, :ref:`Automation <automation>`): An automation to perform when data is received from an unknown peer. See :ref:`espnow-on_unknown_peer`.
3837
- **on_broadcast** (*Optional*, :ref:`Automation <automation>`): An automation to perform when a broadcast packet is received.
3938
See :ref:`espnow-on_broadcast`.
4039

@@ -76,7 +75,7 @@ Configuration variables:
7675
``on_unknown_peer``
7776
*******************
7877

79-
This automation will be triggered when data is received from a peer that is not in the list of known peers.
78+
This automation will be triggered when data is received from a peer that is not in the list of known peers. This trigger gives you one possibility to decide if the unknown peer can be added or not.
8079

8180
.. _espnow-on_broadcast:
8281

@@ -118,14 +117,17 @@ Configuration variables:
118117

119118
- **address** (**Required**, :ref:`templatable <config-templatable>`, MAC Address): The MAC address of the receiving device to send to.
120119
- **data** (**Required**, :ref:`templatable <config-templatable>`, string or list of bytes): The data to be sent.
121-
- **on_sent** (*Optional*, :ref:`Automation <automation>`): An automation to perform when the data is sent successfully.
122120
- **wait_for_sent** (*Optional*, boolean): The automation will wait for the data to be sent and for the ``on_sent`` or ``on_error``
123121
actions to be finished before continuing with the next action.
124122
Defaults to ``true``.
125-
- **on_error** (*Optional*, :ref:`Automation <automation>`): An automation to perform when the data could not be sent.
126123
- **continue_on_error** (*Optional*, boolean): If set to ``false``, the next action will not be triggered if the data could not be sent.
127124
Defaults to ``true``.
128125

126+
Automations:
127+
128+
- **on_sent** (*Optional*, :ref:`Automation <automation>`): An automation to perform when the data is sent successfully.
129+
- **on_error** (*Optional*, :ref:`Automation <automation>`): An automation to perform when the data could not be sent.
130+
129131

130132
.. _espnow-broadcast-action:
131133

@@ -189,6 +191,24 @@ Configuration variables:
189191

190192
- **address** (**Required**, MAC Address): The Peer address that needs to be removed from the list of allowed peers.
191193

194+
.. _espnow-set_channel-action:
195+
196+
``espnow.set_channel`` Action
197+
*****************************
198+
199+
This is an :ref:`Action <config-action>` to change the channel that espnow is sending and receiving on.
200+
201+
.. code-block:: yaml
202+
203+
on_...:
204+
- espnow.set_channel:
205+
channel: 1
206+
- espnow.set_channel: 1
207+
208+
Configuration variables:
209+
210+
- **channel** (**Required**, int): This can be a value between ``0`` and ``15``. The maximum channel number depends on the country or region where you are using the device (for example, channels 1-11 are allowed in the US and most of Europe, 1-13 in many other countries, and 1-14 in Japan). For details, see the `Wi-Fi channel regulations by country <https://en.wikipedia.org/wiki/List_of_WLAN_channels>`__ or consult the `Espressif ESP-NOW documentation <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/network/esp_now.html>`__. ``0`` means that espnow will set the channel number itself (most of the time it would be ``1``).
211+
192212

193213
.. _espnow-peers:
194214

@@ -204,6 +224,7 @@ will be an error when trying to send data to a peer.
204224
Setting ``auto_add_peer`` to ``true`` will allow the component to automatically add any incoming device as a peer, and will
205225
automatically add any peer that data is sent to.
206226

227+
207228
See Also
208229
--------
209230

0 commit comments

Comments
 (0)