Skip to content

Commit 6f56b40

Browse files
HeManclydebarrow
andauthored
Document multicast support for udp component (#4576)
Co-authored-by: Clyde Stubbs <[email protected]>
1 parent b1b855e commit 6f56b40

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

components/udp.rst

+31-4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Configuration variables:
5656
- **port** (*Optional*, int): The destination UDP port number to use. Defaults to ``18511``.
5757
- **addresses** (*Optional*, list of IPv4 addresses): One or more IP addresses to broadcast data to. Defaults to ``255.255.255.255``
5858
which is the local network broadcast address.
59+
- **listen_address** (*Optional*, IPv4 address): Changes to multicast, adding an address to listen to. Defaults to no multicast address, just
60+
local network broadcast address ``255.255.255.255``. **NOTE**: Adding a multicast address stops it from listening on the broadcast address.
5961
- **sensors** (*Optional*, list): A list of sensor IDs to be broadcast. Each entry may be just the sensor id, or may set a different id to be broadcast.
6062

6163
- **id** (**Required**, :ref:`config-id`): The id of the sensor to be used
@@ -114,8 +116,8 @@ attacks on the encryption much more difficult. This is enabled in the provider c
114116

115117
For further protection a ``ping-pong`` (or challenge-response) facility is available, which can be enabled in the
116118
consumer configuration. The consumer periodically generates a 32 bit random number (a *nonce* aka "Number used Once")
117-
and broadcasts it as a *ping*. Any provider receiving this nonce will include it in any future encrypted broadcasts as
118-
*pong*. The consumer expects to get back its most recently transmitted *ping* in any packets it receives, and will reject
119+
and broadcasts it as a *ping*. Any provider receiving this nonce will include it in any future encrypted broadcasts as
120+
*pong*. The consumer expects to get back its most recently transmitted *ping* in any packets it receives, and will reject
119121
any that do not contain it.
120122

121123
Use of the ping-pong feature will add to network traffic and the size of the transmitted packets (a single packet may
@@ -263,7 +265,7 @@ the port specified in the ``udp_external`` configuration:
263265
- humi_rooma
264266
- humi_roomb
265267
- humi_roomc
266-
268+
267269
- id: udp_external
268270
update_interval: 60s
269271
encryption: "Muddy Waters"
@@ -284,9 +286,34 @@ the port specified in the ``udp_external`` configuration:
284286
provider: remote-node
285287
remote_id: binary_sensor_unlock_me
286288
on_press:
287-
- lambda: |-
289+
- lambda: |-
288290
ESP_LOGI("main", "d command to binary_sensor_unlock");
289291
292+
The example below shows two devices communicating via multicast:
293+
294+
.. code-block:: yaml
295+
296+
# Device 1
297+
binary_sensor:
298+
- platform: gpio
299+
pin: D2
300+
id: binary_sensor_door
301+
302+
udp:
303+
- id: mc_external
304+
address:
305+
- 239.0.60.53
306+
binary_sensors:
307+
- binary_sensor_door
308+
309+
# Device 2
310+
binary_sensor:
311+
- platform: udp
312+
id: remote_door_sensor
313+
remote_id: mc_external
314+
315+
udp:
316+
listen_addresses: 239.0.60.53
290317
291318
.. [#f1] As known in 2024.06.
292319

0 commit comments

Comments
 (0)