Skip to content

Commit ff07c8e

Browse files
EasilyBoredEngineernagyrobiswoboda1337
authored
Espnow packet transport (#5458)
* Create espnow.md * Update espnow.md * Update espnow.md attempt to get links working * Update uart.md * Update uart.md reverted accidental change * Update espnow.md hopefully got the md formatting correct... * Update espnow.md linting * Update espnow.md update example * Update espnow.md * Update espnow.md fix hugo spack attack * Remove hardware-specifics from example * Update espnow.md remove #espnow * Update espnow.md removed configuration values section per @swoboda1337 request * Update espnow.md re add config values, diffrent format. * Update espnow.md capitalisation * Update espnow.md remove bellybutton lint * Update _index.md add espnow as available component * remove specific variant list * remove ota example per swaboda request * Misc cleanup * More cleanup --------- Co-authored-by: H. Árkosi Róbert <[email protected]> Co-authored-by: Jonathan Swoboda <[email protected]>
1 parent 18b9bb9 commit ff07c8e

File tree

2 files changed

+195
-1
lines changed

2 files changed

+195
-1
lines changed

content/components/packet_transport/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ params:
1212
The purpose of this component is to allow ESPHome nodes to directly communicate with each over a communication channel.
1313
It permits the state of sensors and binary sensors to be transmitted from one node to another, without the need for a
1414
central server or broker. The actual transport channel is provided by another component. Currently the supported
15-
transports are {{< docref "/components/sx126x" >}}, {{< docref "/components/sx127x" >}}, {{< docref "/components/uart" >}} and {{< docref "/components/udp" >}}.
15+
transports are {{< docref "/components/espnow" >}}, {{< docref "/components/sx126x" >}}, {{< docref "/components/sx127x" >}}, {{< docref "/components/uart" >}} and {{< docref "/components/udp" >}}.
1616

1717
Nodes may be *providers* which transmit or broadcast sensor data, or *consumers* which receive sensor data from one or more
1818
providers. A node may be both a provider and a consumer. Optional security is provided by one or more of:
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
---
2+
description: "Instructions for setting up an ESP-NOW packet transport platform on ESPHome"
3+
title: "ESP-NOW Packet Transport Platform"
4+
params:
5+
seo:
6+
description: Instructions for setting up an ESP-NOW packet transport platform on ESPHome
7+
image: espnow.svg
8+
---
9+
10+
{{< anchor "espnow-packet-transport" >}}
11+
12+
The [Packet Transport Component](#packet-transport) platform allows ESPHome nodes to directly communicate with each over a communication channel. The ESP-NOW implementation of the platform uses ESP-NOW as a communication medium. See the [Packet Transport Component](#packet-transport) and {{< docref "/components/espnow" >}} for more information.
13+
14+
ESP-NOW provides low-latency, low-power wireless communication between ESP32 devices without requiring a Wi-Fi connection. This makes it ideal for battery-powered sensors or applications where Wi-Fi overhead would impact performance.
15+
16+
> **Note:**
17+
> ESP-NOW communication occurs independently of Wi-Fi. Devices can communicate via ESP-NOW even when Wi-Fi is disabled, making it suitable for power-sensitive applications.
18+
19+
## Example Configuration
20+
21+
```yaml
22+
# Example configuration entry
23+
espnow:
24+
id: espnow_component
25+
26+
packet_transport:
27+
- platform: espnow
28+
id: transport_unicast
29+
espnow_id: espnow_component
30+
peer_address: "AA:BB:CC:DD:EE:FF"
31+
encryption:
32+
key: "0123456789abcdef0123456789abcdef"
33+
sensors:
34+
- temp_sensor
35+
36+
sensor:
37+
- platform: internal_temperature
38+
id: temp_sensor
39+
name: "Test Temperature"
40+
```
41+
42+
## Configuration Variables
43+
44+
- **espnow_id** (**Required**, [ID](#config-id)): The esp-now ID to use for transport.
45+
- **peer_address** (*Optional*, MAC Address): MAC address to send packets to. This can be either a specific
46+
peer address for point-to-point communication, or the broadcast address. Default FF:FF:FF:FF:FF:FF
47+
- All other options from the [Packet Transport Component](#packet-transport)
48+
49+
> **Note:**
50+
> Peers must be registered with the {{< docref "/components/espnow" >}} component before
51+
> they can receive packets. The `peer_address` only controls which peer(s) receive transmitted data;
52+
> incoming packets are accepted from all registered peers.
53+
54+
## Broadcast vs Unicast
55+
56+
The `peer_address` configuration determines the transmission mode.
57+
58+
### Broadcast Mode (default)
59+
60+
```yaml
61+
packet_transport:
62+
- platform: espnow
63+
sensors:
64+
- sensor_id
65+
```
66+
67+
All devices with the broadcast address (`FF:FF:FF:FF:FF:FF`) registered as a peer will receive the packets. This is useful for hub-and-spoke topologies where multiple devices monitor a single sensor source.
68+
69+
> **Warning:**
70+
> Using broadcast mode increases ESP-NOW traffic on the radio channel, which may impact performance of other ESP-NOW devices in range. Use specific peer addresses whenever possible to minimize interference.
71+
72+
### Unicast Mode
73+
74+
```yaml
75+
packet_transport:
76+
- platform: espnow
77+
peer_address: "AA:BB:CC:DD:EE:FF"
78+
sensors:
79+
- sensor_id
80+
```
81+
82+
Only the specified peer receives the packets. This is more efficient for point-to-point communication and reduces radio channel congestion for neighboring ESP-NOW devices.
83+
84+
## Simple Example
85+
86+
This example shows two devices exchanging sensor data over ESP-NOW with encryption enabled.
87+
88+
### Temperature Provider
89+
90+
```yaml
91+
espnow:
92+
peers:
93+
- mac_address: "AA:BB:CC:DD:EE:01" # Device 2
94+
95+
packet_transport:
96+
- platform: espnow
97+
peer_address: "AA:BB:CC:DD:EE:01" # Send to Device 2
98+
encryption: "MySecretKey123"
99+
sensors:
100+
- outdoor_temp
101+
102+
sensor:
103+
- platform: ...
104+
temperature:
105+
name: "Outdoor Temperature"
106+
id: outdoor_temp
107+
```
108+
109+
### Temperature Consumer
110+
111+
```yaml
112+
espnow:
113+
peers:
114+
- mac_address: "AA:BB:CC:DD:EE:00" # Device 1
115+
116+
packet_transport:
117+
- platform: espnow
118+
encryption: "MySecretKey123"
119+
providers:
120+
- name: temp-sensor
121+
122+
sensor:
123+
- platform: packet_transport
124+
provider: temp-sensor
125+
id: remote_temp
126+
remote_id: outdoor_temp
127+
name: "Remote Outdoor Temperature"
128+
```
129+
130+
## Multi-Device Hub Example
131+
132+
This example shows a central hub receiving sensor data from multiple remote devices.
133+
134+
### Hub Device
135+
136+
```yaml
137+
espnow:
138+
peers:
139+
- mac_address: "FF:FF:FF:FF:FF:FF"
140+
141+
packet_transport:
142+
- platform: espnow
143+
encryption: "HubSecret123"
144+
providers:
145+
- name: room-sensor-1
146+
- name: room-sensor-2
147+
- name: outdoor-sensor
148+
149+
sensor:
150+
- platform: packet_transport
151+
provider: room-sensor-1
152+
remote_id: temperature
153+
name: "Room 1 Temperature"
154+
155+
- platform: packet_transport
156+
provider: room-sensor-2
157+
remote_id: temperature
158+
name: "Room 2 Temperature"
159+
160+
- platform: packet_transport
161+
provider: outdoor-sensor
162+
remote_id: temperature
163+
name: "Outdoor Temperature"
164+
```
165+
166+
### Remote Sensors
167+
168+
```yaml
169+
espnow:
170+
peers:
171+
- mac_address: "FF:FF:FF:FF:FF:FF"
172+
173+
packet_transport:
174+
- platform: espnow
175+
peer_address: "FF:FF:FF:FF:FF:FF"
176+
encryption: "HubSecret123"
177+
sensors:
178+
- temperature
179+
180+
sensor:
181+
- platform: ...
182+
temperature:
183+
id: temperature
184+
```
185+
186+
## See Also
187+
188+
- [Packet Transport Component](#packet-transport)
189+
- {{< docref "/components/espnow" >}}
190+
- {{< docref "/components/binary_sensor/packet_transport" >}}
191+
- {{< docref "/components/sensor/packet_transport" >}}
192+
- [UDP Packet Transport](#udp-packet-transport)
193+
- [Automation](#automation)
194+
- {{< apiref "packet_transport/espnow_transport.h" "packet_transport/espnow_transport.h" >}}

0 commit comments

Comments
 (0)