This is an XBee packet decoder written in Python 3.
It is a work in progress. The current version decodes all the standard XBee packets, and provides further decoding of a limited (but growing) selection of Zigbee Device Object (ZDO) commands (eg. 16-bit network address request) and general (aka ‘global’) Zigbee Cluster Library commands (eg. Read Attribute).
Run XBeeParser at the command line and provide a code XBee packet as a string of hexadecimal octets:
$ python xbp.py 7e0020950013a20040522baa7d84027d840013a20040522baa2000fffe0101c105101e1b
The XBee packet string need not be a single string; you can also include spaces:
$ python xbp.py 7e 95-20-00 00 00-a2-13 2-52-40b aa 7d 7-02-84d 13-00-84 a40-00-2 52 2b aa 20 00 ff fe 01 05-c1-01 1-1e-10b
To simplify usage of XBeeParser, run the following commands:
mv xbp.py /usr/local/bin/xbp
chmod +x /usr/local/bin/xbp
Then you run XBeeParser from any location in your filesystem:
$ xbp 7e 88-05-00 45-45-05 00 e8
By default, XBeeParser assumes packets have been escaped, but this can be disabled with the -e
or --escape
switch. Follow this with false
to disable escaping (or true
to be explicit about enabling escaping.
XBeeParser has the following options:
Short | Long | Values | Description |
---|---|---|---|
-e | --escape | true or false | Use escaping when decoding packets. Default: true |
-d | --debug | true or false | Show extra debug information. Default: false |
-v | --version | N/A | Show version information |
-h | --help | N/A | Show help information |
$ python xbp.py -d true -e false 7e0020950013a20040522baa7d84027d840013a20040522baa2000fffe0101c105101e1b
This generates the following output:
Extra debugging information will be printed during decoding
Packet decoding will not use escaping
7E0020950013A20040522BAA7D84027D840013A20040522BAA2000FFFE0101C105101E1B
XBee frame found
Frame length : 32 bytes
XBee command ID : 95 "Node identification indicator response"
Address (64-bit) : 0013A20040522BAA
Address (16-bit) : 7D84
Status : Packet a Broadcast Packet
Address (16-bit) : 7D84
Address (64-bit) : 0013A20040522BAA
NI string : Default
Parent address (16-bit) : FFFE
Device type : Router
Source event : Pushbutton
Digi Profile ID : C105
Manufacturer ID : 101E
Checksum : 1B
$ python xbp.py 7E 002D 40522-0013A200-91BAA 06FC 8038-00-00 01-01-0000 1-00F8FF07-00D10-0000-00 69-5E-54 5B 4B 48-44-48 57-55-55 41-51-46 6-4B-44E
This generates the following output:
XBee frame found
Frame length : 45 bytes
XBee command ID : 91 "Zigbee explicit RX indicator"
Address (64-bit) : 0013A20040522BAA
Address (16-bit) : 06FC
Source endpoint : 00
Destination endpoint : 00
Cluster ID : 8038
Profile ID : 0000
Status : Packet acknowledged
Frame data : 010000F8FF071D00000010545E695B4B484448555557465141444B
ZDO command : Management Network Update Response
Transaction seq. number : 01
Response status : Success
Checksum : 6E
You can view XBeeParser’s source code at GitHub.
0xA4
, register joining device status; 0xA5
, join notification status.