Send broadcast data
In previous generations, the socket Python module was used to send broadcast data to all the XBee nodes of the network:
- Create a socket with the required XBee options.
- Bind it to the desired end point, cluster ID, and profile ID.
- Only explicit data can be sent as you have to specify end point, cluster ID, and profile ID when building the destination address. Also, you must specify the broadcast address in the destination address.

import xbee
from socket import *
# Broadcast address is "[00:00:00:00:00:00:FF:FF]!"
DESTINATION=("[00:00:00:00:00:00:FF:FF]!", 0xe8, 0xc105, 0x11)
# Create the socket, datagram mode, proprietary transport:
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_TRANSPORT)
# Bind to endpoint 0xe8 (232) for ZB/DigiMesh, but 0x00 for 802.15.4
s.bind(("", end_point, profile_id, cluster_id))
# Send "Hello, World!" to the destination node, endpoint,
# using the profile_id and cluster_id specified in DESTINATION:
sd.sendto("Hello, World!", 0, DESTINATION)
In the new XBee gateways, the way data is broadcast to all XBee devices in the network is totally different. Using the digidevice.xbee Python module, you can send data to any remote XBee using the local XBee instance. You can also broadcast explicit data to a specific end point, cluster ID, and profile ID.
Standard data broadcast
Once you have the local XBee instance:
- Invoke the send_data_broadcast(data) method specifying the data to broadcast.
New API
from digidevice import xbee
DATA_TO_SEND = "Hello, World!"
device = xbee.get_device()
try:
device.open()
device.send_data_broadcast(DATA_TO_SEND)
finally:
if device.is_open():
device.close()
Explicit data broadcast
Once you have the local XBee instance:
- Invoke the send_expl_data_broadcast(data, source_end_point, dest_end_point, cluster_id, profile_id) method specifying the data to broadcast, the end points, the cluster ID, and the profile ID.
New API
from digidevice import xbee
DATA_TO_SEND = "Hello, World!"
SRC_ENDPOINT = 0xA0
DEST_ENDPOINT = 0xA1
CLUSTER_ID = 0x1554
PROFILE_ID = 0x1234
device = xbee.get_device()
try:
device.open()
device.send_expl_data_broadcast(DATA_TO_SEND, SRC_ENDPOINT, DEST_ENDPOINT, CLUSTER_ID, PROFILE_ID)
finally:
if device.is_open():
device.close()