I am new to working with Digi products and I have a question. I am currently working with a custom Zigbee device (end device), and I need to send a ZDO (Zigbee Device Object) command from the gateway. Could you please provide a Python example or guide on how to achieve this?
Thank you for your response. I reviewed the example, but I am encountering some issues. When I use the command xbee_network.get_device_by_64("********"), my device is not being discovered. However, when I check through the UI and terminal, the device is listed as discovered.
Additionally, for sending a ZCL frame (specifically for reading attributes), I used the send_packet function. Could you please confirm if this is the correct approach?
Thank you for your assistance. I made some adjustments to the Zigbee profile using XCTU, and the code appears to be working now.
Here is the updated code I am using:
import logging
from digidevice import xbee
from digi.xbee.devices import XBee64BitAddress
logging.basicConfig(level="DEBUG", format="%(asctime)s %(message)s")
def main():
try:
local_device = xbee.get_device()
local_device.open()
xbee_network = local_device.get_network()
remote_device_address = "00XXXXXXXXXXXX"
spec_node = xbee_network.get_device_by_64(XBee64BitAddress.from_hex_string(remote_device_address))
if spec_node is None:
print("Device with 64-bit addr: %s not found" % str(spec_node))
else:
print("OK!")
except Exception as e:
print("Error: %s" % e)
if __name__ == '__main__':
main()
While this code is now functioning, I am still unclear about how to send a command to an end device, such as read attributes(0x00) (Digi XBee® 3 Zigbee® RF Module) . The RF documentation typically pertains to modules connected via serial to the Zigbee device, but I am working with a Digi Gateway. As I know I need to build my packet and send via local_device. ?.
What do you mean by Read Parameters? For a 3rd party device, you would need to send a ZDO command to discover the devices supported or active end points. Digi XBee® 3 Zigbee® RF Module
It again is a function of the xbee.transmit function.
so I cannot read attributes with python on Digi Gateway IX 15 using ethernet cable and upload script? I have to use micropython and connect gateway via serial to pc and use XCTU?
May I suggest you use the Example Python application Digi offers in PyCharm and the PyCharm plugin? There are two examples offered. One for reading and one for sending Explicit Data Samples over the XBee built in the IX15. The code will reside on the IX15. What you decided to do with that data and where you send it is up to you.
I will note that XCTU is not capable of making a direct connection to the XBee found in the IX15. That is not what the XCTU software or XBee Studio is for. These software programs are for talking with the OEM modules connected via a Interface board.