Release v0.5.1
Hachi is a Python library to interact with XBees.
Read XBeeResponse:
>>> import hachi
>>> from hachi.serial import XBeeSerial
>>> x = XBeeSerial('/dev/ttyUSB0')
>>> x.read_response()
<ZBIoSampleResponse(len=18)>
Send XBeeRequest:
>>> request = hachi.AtRequest('ID', 0xff)
>>> x.send(request)
>>> response = x.read_response()
>>> response
<AtResponse(len=xx)>
>>> response.status == hachi.COMMAND_STATUS_OK
True
Use the XBeeProtocol:
>>> import hachi
>>> from hachi.twisted import XBeeProtocol
>>> from twisted.internet import reactor
>>> from twisted.internet.serialport import SerialPort
>>> class TestXBee(XBeeProtocol):
... def responseReceived(self, response):
... print(response)
...
>>> serial = SerialPort(TestXBee(), '/dev/ttyUSB0', reactor, baudrate=9600)
>>> reactor.run()
<ZBIoSampleResponse(len=18)>
<ZBIoSampleResponse(len=18)>
<ZBIoSampleResponse(len=18)>
If you are looking for information on a specific function, class or method, this part of the documentation is for you.