Prerequisites:
In Esphome 2024.9 release Esphome introduced new way of communication between nodes using UDP broadcast.
More info of the component is available at Esphome documentation: https://esphome.io/components/udp
Communication can go both way, let’s assume that we have 2 boneIO ESP. We want to share:
boneio-32-l-07-abcdef
to boneIO-2 with name boneio-32-l-07-ghijkl
, which would switch Light02 on boneIO-2.boneio-32-l-07-ghijkl
to boneIO-1 with name boneio-32-l-07-abcdef
, which would switch Light03 on boneIO-1.Both boneIO need to be on the same subnet. In case of different subnets see below example.
In this guide we’d assume that we have config for both boneIO as follow. You’d need to remember name of the boneIO.
substitutions:
name: boneio-32-l-07-abcdef
friendly_name: boneIO-1
serial_prefix: esp #Don't change it.
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: boneio.32x10-lights
version: '0.7'
substitutions:
name: boneio-32-l-07-ghijkl
friendly_name: boneIO-2
serial_prefix: esp #Don't change it.
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: boneio.32x10-lights
version: '0.7'
UDP section allows sending data with sensors or binary sensors data. By default it sends data to broadcast address 255.255.255.255.
Binary sensors section is section responsible for sending sensors to another device.
Providers section is responsible for receiving data from another device.
udp:
update_interval: 5s
encryption: 'ENCRYPTION1KEY' #set it to yours shared secret key
rolling_code_enable: true
binary_sensors:
- in_01
providers:
- name: boneio-32-l-07-ghijkl
encryption: 'ENCRYPTION2KEY' #set it to yours shared secret key
udp:
update_interval: 5s
encryption: 'ENCRYPTION2KEY' #set it to yours shared secret key
rolling_code_enable: true
binary_sensors:
- in_02
providers:
- name: boneio-32-l-07-abcdef
encryption: 'ENCRYPTION1KEY' #set it to yours shared secret key
Now let’s import binary sensors of another node:
This imports sensor from boneIO-2
binary_sensor:
- platform: udp
provider: boneio-32-l-07-ghijkl
id: ghijkl_in_02 #OR CHANGE TO SOMETHING MORE SUITABLE FOR YOU
remote_id: in_02
on_press:
- light.toggle: light_01
This imports sensor from boneIO-1
binary_sensor:
- platform: udp
provider: boneio-32-l-07-abcdef
id: abcdef_in_01 #OR CHANGE TO SOMETHING MORE SUITABLE FOR YOU
remote_id: in_01
on_press:
- light.toggle: light_01
Remember that you can’t duplicate sections, so add udp platform to your existing binary sensors. Don’t create new one!
substitutions:
name: boneio-32-l-07-abcdef
friendly_name: boneIO-1
serial_prefix: esp #Don't change it.
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: boneio.32x10-lights
version: '0.7'
udp:
update_interval: 5s
encryption: 'ENCRYPTION1KEY' #set it to yours shared secret key
rolling_code_enable: true
binary_sensors:
- in_01
providers:
- name: boneio-32-l-07-ghijkl
encryption: 'ENCRYPTION2KEY' #set it to yours shared secret key
binary_sensor:
- platform: udp
provider: boneio-32-l-07-ghijkl
id: ghijkl_in_02 #OR CHANGE TO SOMETHING MORE SUITABLE FOR YOU
remote_id: in_02
on_press:
- light.toggle: light_01
substitutions:
name: boneio-32-l-07-ghijkl
friendly_name: boneIO-2
serial_prefix: esp #Don't change it.
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: boneio.32x10-lights
version: '0.7'
udp:
update_interval: 5s
encryption: 'ENCRYPTION2KEY' #set it to yours shared secret key
rolling_code_enable: true
binary_sensors:
- in_02
providers:
- name: boneio-32-l-07-abcdef
encryption: 'ENCRYPTION1KEY' #set it to yours shared secret key
binary_sensor:
- platform: udp
provider: boneio-32-l-07-abcdef
id: abcdef_in_01 #OR CHANGE TO SOMETHING MORE SUITABLE FOR YOU
remote_id: in_01
on_press:
- light.toggle: light_01
If you have your boneIO on different subnets then you’d need set addresses to which send data of the udp component. You can set data to many nodes on your network!
udp:
update_interval: 5s
encryption: 'ENCRYPTION1KEY' #set it to yours shared secret key
rolling_code_enable: true
addresses: ['192.168.1.10']
binary_sensors:
- in_01
After modifying your config click install on both boneIO, then choose Wirelessly and wait for both to finish.