I am wondering how one goes about sending a ZDO command using the python library. I am able to send them from an S2C chip using XCTU using the frame packet maker. In particular I am looking for ZDO IEEE ADDR REQ. From the literature and the Digi wiki there doesnt seem to be any support for those commands even though the S2C and S2B chips in the X4 gateways can send them. When I attempt to send the hex string generated by the packet maker using the socket method. Nothing comes out of the module. Ubiqua can confirm this.
Any one know why this is? How do I get ZDO commands at the Python level?
How are you opening and writing to the socket? It requires special handling to specify the protocol, endpoint, etc and to specify the destination address when writing to the socket.
I am using the socket method. Just like the hello world example given. But instead of “hello world” i send the hex string generated by the packet maker. What would the specfic method be?
I’m not familiar with that example but pulled the following code from your comment history. And made some modification that should be suitable for sending ZDO messages. Review the comments for some useful comments. I haven’t tested this yet but might get you a little closer.
fill cmd_payload to the ZDO command frame you are trying to send
cmd_payload = ‘’
zdo_payload must be prefixed with a single-byte TSN and then the actual command payload
you likely don’t need to worry about matching responses against TSN at this point so hardcode
zdo_payload = ‘\x00’ + command_payload
ZDO messages are Endpoint 0x0 and Profile 0x0
Adjust the final Cluster ID 0x0 below to desired ZDO command
In my code I’ve always prefixed/suffixed the address with “[” and “]!”. Possible that may
have changed recently but the old style should still work and might be safer depending on the
platform you are on?
DESTINATION=(“[00:12:4b:00:07:b5:64:81]!”, 0x0, 0x0, 0x0)
I’ve always used XBS_PROT_TRANSPORT though from just looking at the documentation see that
XBS_PROT_APS should technically be correct. If nothing else works try swapping to
XBS_PROT_TRANSPORT and see if that works.
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_APS)
Bind to ZDO Endpoint (0x0) on gateway
sd.bind((“”, 0x0, 0, 0))
SentMsg = sd.sendto(zdo_payload,0,DESTINATION)
This worked. The ZDO Payload had to be modified but it work.