Skip to main content

Python tools for working with XBee radios

Project description

XBee provides an implementation of the XBee serial communication API. It allows one to easily access advanced features of one or more XBee devices from an application written in Python. An example use case might look like this:

#! /usr/bin/python

# Import and init an XBee device
from xbee import XBee
import serial

ser = serial.Serial('/dev/ttyUSB0', 9600)
xbee = XBee(ser)

# Set remote DIO pin 2 to low (mode 4)
xbee.remote_at(
  dest_addr='\x56\x78',
  command='D2',
  parameter='\x04')

xbee.remote_at(
  dest_addr='\x56\x78',
  command='WR')

Installation

Extract the source code to your computer, then run the following command in the root of the source tree:

python setup.py install

This will automatically test and install the package for you.

Additionally, one may run this package’s automated tests at any time by executing:

python setup.py test

If a Test Fails

If an automated test fails, the installation will be halted to prevent one from using a potentially broken build.

In this event, one may comment out the ‘strict’ flag in setup.cfg in order to force the installation to proceed. Do so at your own risk.

Usage

Series 1, Series 2

To use this library with an XBee device, import the class XBee and call its constructor with a serial port object.

In order to send commands via the API, call a method with the same name as the command which you would like to send with words separated by _’s. For example, to send a Remote AT command, one would call remote_at().

The arguments to be given to each method depend upon the command to be sent. For more information concerning the names of the arguments which are expected and the proper data types for each argument, consult the API manual for your XBee device, or consult the source code.

Caveats

Escaped API operation has not been implemented at this time.

Dependencies

PySerial

Additional Dependencies (for running tests):

Nose

XBee Firmware

Please ensure that your XBee device is programmed with the latest firmware provided by Digi. Using old firmware revisions is not supported and may result in unspecified behavior.

Contributors

Paul Malmsten <pmalmsten@gmail.com>

Special Thanks

Amit Synderman, Marco Sangalli

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

XBee-1.9.0.tar.gz (19.5 kB view details)

Uploaded Source

File details

Details for the file XBee-1.9.0.tar.gz.

File metadata

  • Download URL: XBee-1.9.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for XBee-1.9.0.tar.gz
Algorithm Hash digest
SHA256 7be029a49120566ae3f3bc5ff2a24a38ee8386fd5a486d1af43acc3d7962bab4
MD5 b29c9afa2fd85d2d527831699b7e755a
BLAKE2b-256 8949baa59a8a34521efef5aeff2d31dc545c904330ff9055919e54aa6db2f21f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page