Git Product home page Git Product logo

python-xbee's People

Contributors

pmalmsten avatar

Stargazers

 avatar

Watchers

 avatar  avatar

python-xbee's Issues

IndexError for misshaped packets

What steps will reproduce the problem?
1. Had the receiver running, the error appeared roughly after a week of use

What is the expected output? What do you see instead?
Nothing - the erroneous packet is discarded


What version of the product are you using? On what operating system?
Raspian

Please provide any additional information below.

My assumption is that there should be an extra check if there even is anything 
in the data. Possibly this is a very unusual situation which is caused by the 
middleware used.

Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 69, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 586, in _doReadOrWrite
    why = selectable.doRead()
  File "/usr/lib/python2.7/dist-packages/twisted/internet/_posixserialport.py", line 62, in doRead
    return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/fdesc.py", line 94, in readFromFD
    callback(output)
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/basic.py", line 572, in dataReceived
    return self.rawDataReceived(data)
  File "/home/pi/open-zb-home/xbeeService/protocol.py", line 23, in rawDataReceived
    return getattr(self, "handle_packet", None)(self._split_response(self.frame.data))
  File "/home/pi/open-zb-home/xbee/base.py", line 205, in _split_response
    packet_id = data[0]
exceptions.IndexError: string index out of range

Original issue reported on code.google.com by [email protected] on 9 Nov 2012 at 3:58

x92 frame for ZB is not showing the right info ( i think )

What steps will reproduce the problem?
1. ZigBee Coord and Router
2. from Coord xbee.remote.at( .... frame_id ='A'
3.

What is the expected output? What do you see instead?
the answer is
{'status":.. but is not showing the In/Out status as explained on zigbee.py ( I 
think is not parsing )

What version of the product are you using? On what operating system?
2.1.0

Please provide any additional information below.

I am not an expert so please expect that I am doing something wrong.

Original issue reported on code.google.com by [email protected] on 14 Aug 2013 at 6:35

Does not install on Centos5 (Py:2.4.3)

Hi,

install fails with SyntaxError on Contos5 (Py:2.4.3)

---
File "/usr/lib/python2.4/site-packages/xbee/base.py", line 341
tmp_samples['dio-%d' % i] = True if (digital_values >> i) & 1 else False

SyntaxError: invalid syntax

---

After changing this line to a more common Syntax the package compiles fine.

Many Thanks for this very usefull interface!
Joerg 

Original issue reported on code.google.com by [email protected] on 2 Feb 2012 at 8:33

Add support for ZigBee messages

I'm using a number of Digi XBee ZB modules and needed support for some of the 
API commands and responses that are specific to the ZigBee firmware.  This 
patch adds the "zb_tx_request" and "zb_explicit_tx_request" API commands and 
the "zb_tx_status", "zb_rx", "zb_explicit_rx", "zb_rx_io_data", 
"zb_rx_sensor_read" and  "zb_node_ident" API responses.  The IO packets have a 
different structure from the ones already implemented; they're close but 
different enough that the values were wrong. I implemented a new method to 
parse these packets (_parse_zb_samples) and a new flag in the structure dict 
(parse_as_zb_io_samples) to indicate that the packets should be parsed with 
this new routine.  I also added another option to the 'len' structure field; 
instead of None or an actual length in bytes, "null_terminated_string" is not 
an option. This is used for parsing the NI response, as the node identifier 
string is a null-terminated string embedded in the middle of the packet.  Quite 
annoying… :-)

Tests have also been implemented for the IO packet parsing and NI response 
packet.  

Original issue reported on code.google.com by [email protected] on 30 Oct 2010 at 2:58

Attachments:

Errors in send command with python 3.3

When I try sending data to an Xbee using the send() method there is a TypeError 
in the base.py file

the script is:
import serial
from xbee import ZigBee

serial_port = serial.Serial('/dev/cu.usbserial-A800f7SH', 9600)
xbee = ZigBee(serial_port)
xbee.send("at", frame='A', command='MY', parameter=None)
xbee.halt()
serial_port.close()

and the output is:
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    xbee.send("at", frame='A', command='MY', parameter=None)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/xbee/base.py", line 386, in send
    self._write(self._build_command(cmd, **kwargs))
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/xbee/base.py", line 201, in _build_command
    packet += data
TypeError: can't concat bytes to str

If I run the same script on python 2.7 it runs fine. I have tried changing the 
command to all of the optional forms in the documentation on page 6 
(xbee.at(command='MY'), etc) but none of the various options have any impact. 


I am using XBee-2.1.0 on Python 3.3 on a mac.

Thanks for your help

Original issue reported on code.google.com by [email protected] on 13 Mar 2014 at 3:19

Improve documentation

There currently is very little useful documentation which describes how one 
might use recent versions of the code.

Original issue reported on code.google.com by [email protected] on 6 Jul 2010 at 3:31

Provide helpful error message when an XBee may be unexpectedly in command mode

What steps will reproduce the problem?
1. using the Tx16Request(0x0000, payload, sizeof(payload));
2. and XBeeAddress64(0x0013a200, 0x4055cbfa);

What is the expected output? What do you see instead?
A new xbee packet
RAW Hex Dump for Tx16 Request:
 7E 00 34 01 01 FF FF 00 30 34 31 35 41 46 43 31 46 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 B2


Got:
Traceback (most recent call last):
  File "test.py", line 15, in <module>
    response = xbee.wait_read_frame()
  File "/usr/local/lib/python2.6/dist-packages/xbee/base.py", line 381, in wait_read_frame
    return self._split_response(frame.data)
  File "/usr/local/lib/python2.6/dist-packages/xbee/base.py", line 213, in _split_response
    % data[0])
KeyError: 'Unrecognized response packet with id byte \x01'




What version of the product are you using? On what operating system?
2.0 on both win and linuxfor python-xbee

2.7 python on win 
2.6 python on linux

Original issue reported on code.google.com by [email protected] on 21 May 2011 at 1:36

ERROR Packet ID byte

What steps will reproduce the problem?
1. run example code
2. xbee Pro
3. python 2.7/ Mac OS X

What is the expected output? What do you see instead?
Traceback (most recent call last):
  File "bola_xbee.py", line 13, in <module>
    response = xbee.wait_read_frame()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xbee/base.py", line 381, in wait_read_frame
    return self._split_response(frame.data)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xbee/base.py", line 213, in _split_response
    % data[0])
KeyError: 'Unrecognized response packet with id byte \x90'


What version of the product are you using? On what operating system?
last one

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 19 Jul 2011 at 9:26

Add automatic parsing of Node Discover at_response packet 'parameter' field

Jim suggests:

I like to use the ND (Node Discover) command to see what nodes have been 
discovered by my coordinator and are on the network. When I issue the command, 
the API returns a standard AT response frame with some of the fields parsed, 
but not all of them. Here is what the raw output looks like:

{'status': '\x00', 'frame_id': 'A', 'parameter': 
'v\x1a\x00\x13\xa2\x00@oG\xe4ENDPOINT-1\x00\xff\xfe\x01\x00\xc1\x05\x10\x1e', 
'command': 'ND', 'id': 'at_response'}

I was wondering if it might be possible to get the 'parameter' field parsed 
into a dictionary in the same way as the I/O fields we've been working with 
lately. From the documentation, here are what the fields would be for 
'parameter', using my example above:

MY – 1 byte                          \x76\x1a
SH – 4 bytes                         \x00\x13\xa2\x00
SL  -- 4 bytes                       \x40\x6f\x47\xe4
NI – Variable                        ENDPOINT-1\x00 (null terminated, I 
assume… the document doesn't say)
Parent Network Address – 2 bytes     \xff\xfe
Device Type – 1 byte                 \x01     (00 = Coordinator, 01 = Router, 
02 = Endpoint)
Status  -- 1 byte                    \x00
Profile_ID  -- 2 bytes               \xc1\x05
Manufacturer  -- 2 bytes             \x10\x1e

Original issue reported on code.google.com by [email protected] on 28 Oct 2011 at 2:09

XBee ZB devices: DIO lines 12 and 4 never parsed as enabled

I have a bunch of Xbee Pro 900HP module and i got a major error, the frame 
decoding is putting a @ symbol when it should be a 40 in the source_addr_long 
field.
{'source_addr_long': '\x00\x13\xa2\x00@\xa5P\xe2', 'source_addr': '\xff\xfe', 
'id': 'rx_io_data_long_addr', 'samples': [{'adc-1': 0, 'adc-2': 933, 'adc-3': 
306}], 'options': '\xc2'}

The real source_addr_long is: 0013a20040a550e2
So
00 13 a2 00 40 a5 50 e2
You can see that the 40 is seen as @ and the 50 is seen as P, what it does is 
that the rest of the frame is shifted so the values are not right!!
Is there any quick bug fixes ?

Original issue reported on code.google.com by [email protected] on 19 Sep 2013 at 1:06

xbee.wait_read_frame() has no time protection

What steps will reproduce the problem?
1. Distant ZigBee (or, open a virtual (non-conected) serial port
2. Open a ZigBee object and run wait_read_frame()
3. The program will not respond anymore

What is the expected output? What do you see instead?
The output could be a integer, or anything else.

What version of the product are you using? On what operating system?
Gentoo Linux. python-xbee 2.0.0

Please provide any additional information below.
I did an implementation, but I would like you take a look on it.

Original issue reported on code.google.com by [email protected] on 10 Mar 2012 at 2:09

Attachments:

XBee ZB response definitions are incomplete

I attached a new ZB device to my network and all of my software started 
crashing.  The documentation for wait_read_frame says it will wait until a 
valid frame appears.  There is no mention of any exceptions being raised.  If a 
frame arrives with an unexpected frame ID, KeyError is raised.

_wait_for_frame looks like it's catching a ValueError and retrying, but 
_split_response can raise KeyError.

I'm kind of new to Mercurial, but I believe I have two fixes for you to look at:

http://code.google.com/r/davidmnesting-python-xbee/source/detail?r=5624b2ba2a746
3148f3cbf811f4bffad06b35cc4
This fixes the immediate problem and allows wait_read_frame to avoid raising an 
exception, silently discarding frame types it doesn't understand.
http://code.google.com/r/davidmnesting-python-xbee/source/detail?r=c53e8626dafe8
d650889d5771854510d4efed018
This adds all of the missing frame types I could identify from the latest ZB 
user's guide.

Original issue reported on code.google.com by [email protected] on 21 Jun 2011 at 4:16

Does not work using the example code with XB Pro with DigiMesh firmware

Hi, 

From the documentation for python-xbee 2.0, I used the attached code.

Since I'm on a Windows machine, I had to tweak the code by inputting the port 
number associated with COM4. This code works when using print(ser.readline()) 
but for some reason print(xbee.wait_read_frame()) just doesn't return anything. 
I'm using XBee Pro w/ DigiMesh firmware, the latest version of pySerial, 
python-xbee, and I have the latest version of Python (3.x.x).

I also get the following error:

>>> 
Traceback (most recent call last):
  File "C:\Projects\RonakWaspmote\program\python\readCOM.py", line 14, in <module>
    print(xbee.wait_read_frame())
  File "C:\Python32\lib\site-packages\xbee\base.py", line 390, in wait_read_frame
    return self._split_response(frame.data)
  File "C:\Python32\lib\site-packages\xbee\base.py", line 222, in _split_response
    "Unrecognized response packet with id byte {0}".format(data[0]))
KeyError: 'Unrecognized response packet with id byte 144'

What could be the problem? Is it the firmware?

Original issue reported on code.google.com by ronthecon on 3 Feb 2012 at 7:32

Attachments:

update the code examples to stress the importance of parameter 'escape=...'

First of all thanks a lot for this very nice piece of code!

What steps will reproduce the problem?
1. set up your Xbees in API mode, with the API mode = 2 (AP = 2, means it 
escapes some special bits)
2. run the exemple code that is on http://code.google.com/p/python-xbee/
3. does not work (no frame response displayed , even if you can see in any 
terminal that your Xbee is fine ...)

What is the expected output? What do you see instead?
My point is simply that is is easy for a dummy newbie (like me!) to spend hours 
in trying debugging, while it is a simple parameters issue. I know it is in the 
documentation (thanks for this too ;-)) but it is so important that it should 
be added, I think, as a comment in the exemple code (e.g. #use Zigbee instead 
of Xbee if you are using Series 2 AND add "escape = True" to parameters if 
their AP parameter is set to 2.

What version of the product are you using? On what operating system?
2.1 on a Mac (Python 2.7) but it does not matter.

Please provide any additional information below.
Thank you again and Best Regards

Original issue reported on code.google.com by [email protected] on 24 Apr 2013 at 10:39

api_response structs: type 0x82, request to include sample header values

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?

xbee 1.9.0
XP sp3

Please provide any additional information below.

the static method, "parse_samples_header(data)" returns 3 values that would be 
nice if they were included in the packet type 0x82 (line input states): 

  sample quantity, adc & dio channel indicators

due to the diff in offsets between series I & series 2.5 TX requests this may 
not be feasible. but thought i would ask.

tia


Original issue reported on code.google.com by [email protected] on 17 Jul 2010 at 7:27

IndexError: pop from empty list

What steps will reproduce the problem?
1. running dispatch_async.py
2. print "Samples Received: ", packet['samples']
3.

What is the expected output? What do you see instead?
- error on thread but program continues to run...
- 

What version of the product are you using? On what operating system?
XBee 2.1.0
Linux version 3.6.11+ (on Raspberry pi)

Please provide any additional information below:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 95, in run
    self._callback(self.wait_read_frame())
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 400, in wait_read_frame
    return self._split_response(frame.data)
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 288, in _split_response
    info[parse_rule[0]] = parse_rule[1](self, info)
  File "/usr/local/lib/python2.7/dist-packages/xbee/ieee.py", line 117, in <lambda>
    lambda xbee,original: xbee._parse_samples(original['samples'])
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 364, in _parse_samples
    analog_sample = (sample_bytes.pop(0) << 8 | sample_bytes.pop(0))
IndexError: pop from empty list


Original issue reported on code.google.com by [email protected] on 13 Apr 2014 at 8:29

zigbee response parsing enhancement

Problem: 
sending command ND and IS using the lowercase command (eg: bee.at('nd')) does 
not trigger the command response parsing in zigbee.py because it only looks for 
the capitalised version (bee.at('ND')).

Solution:
Replace line 175
if packet_info['id'] in ('at_response','remote_at_response') and 
packet_info['command'] == b'IS' and packet_info['status'] == b'\x00':
with
if packet_info['id'] in ('at_response','remote_at_response') and 
(packet_info['command'] == b'IS' or packet_info['command'] == b'is') and 
packet_info['status'] == b'\x00':

and 

Replace line 185
if packet_info['id'] == 'at_response' and packet_info['command'] == b'ND' and 
packet_info['status'] == b'\x00':
with
if packet_info['id'] == 'at_response' and (packet_info['command'] == b'ND' or 
packet_info['command'] == b'nd')  and packet_info['status'] == b'\x00':

Original issue reported on code.google.com by [email protected] on 11 Jun 2012 at 3:50

dispatch_async: serialposix.py TypeError

What steps will reproduce the problem?
1. ~/python/XBee-2.1.0/examples# python dispatch_async.py


What is the expected output? What do you see instead?
expected to see output of the handlers.

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/site-packages/xbee/base.py", line 95, in run
    self._callback(self.wait_read_frame())
  File "/usr/lib/python2.7/site-packages/xbee/base.py", line 399, in wait_read_frame
    frame = self._wait_for_frame()
  File "/usr/lib/python2.7/site-packages/xbee/base.py", line 117, in _wait_for_frame
    if self.serial.inWaiting() == 0:
  File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 337, in inWaiting
    s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
TypeError: argument must be an int, or have a fileno() method.

What version of the product are you using? On what operating system?
XB-2.1.0
Python 2.7.3 (default, May 29 2013, 21:25:00)
Linux beaglebone 3.8.13 #1 SMP Wed Jun 5 11:21:00 CEST 2013 armv7l GNU/Linux

Please provide any additional information below.
receive_samples_async.py is working.


Original issue reported on code.google.com by [email protected] on 17 Feb 2014 at 11:08

SerialException when waiting for frame

I am currently using the library with multiple xbee devices configured as 
DigiMesh.  I use an asynchronous callback function for reading data and I 
asynchronously call the write function through the use of other callback 
inputs.  Each xbee device may be tasked with sending and receiving copious 
amounts of data between computers.  I occasionally receive the following error:

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 95, in run
    self._callback(self.wait_read_frame())
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 399, in wait_read_frame
    frame = self._wait_for_frame()
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 131, in _wait_for_frame
    byte = self.serial.read()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 456, in read
    raise SerialException('device reports readiness to read but returned no data (device disconnected?)')
SerialException: device reports readiness to read but returned no data (device 
disconnected?)

Sometimes the error happens immediately, while sometimes it takes time before 
it occurs.  I can also say that it is not due to a bad connection as I have 
confirmed the connection as well as on various different vehicles.  I am 
curious as if it is due to multiple writes and reads possibly colliding as I 
did not see any protection against this.

I appreciate any help someone could give.

Original issue reported on code.google.com by [email protected] on 20 Mar 2014 at 12:12

xbee.wait_read_frame() doesnt return anything

What steps will reproduce the problem?
I already set the xbee in API mode,and run examples/serial_example_serials_1.py.
As is documented that xbee.wait_read_frame() will return the resulting 
dictionary.
But nothing happened.
I can use API mode to set the xbee : xbee.send('at',command='D1','\x04'). then 
i checked in minicom that ATD1 was set to 4
I've test other APIFrames but xbee.wait_read_frame() still returns nothing
Is this a bug or do i need to set someting else in order to receive APIFrames ?


What version of the product are you using? On what operating system?
python-xbee-2.0 gentoo-x86_64


Original issue reported on code.google.com by [email protected] on 31 Dec 2012 at 2:35

api_commands and api_responses differ from Digi API doc dated 5.17.2010

Not sure if I'm missing something, but the api_commands and api_responses 
dictionaries seem to differ significantly from the API frame types and formats 
listed in the Digi Zigbee doc dated 5.17.2010.  Is there a different firmware 
or API I should be using or should I just update the dictionaries to reflect 
the (newer?) API in the Digi doc?  Thanks!

Original issue reported on code.google.com by [email protected] on 8 Aug 2010 at 4:15

Dispatch not for ZigBee

What steps will reproduce the problem?
1.dispatch=Dispatch(ser)
2.
3.

What is the expected output? What do you see instead?
If instantiate 'Dispatch' whit a serial object and not with 
xbee=ZigBee(ser)
dispatch=Dispatch(xbee=xbee) the dict 'self.api_responses' (in line 207, 
base.py) refer to ieee.py not to zigbee.py


What version of the product are you using? On what operating system?
v2.0, OS Mac OS X Leopard

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 30 Jul 2012 at 6:28

Implement threading support

It would be nice if the XBee module allowed one to set a callback function 
which would be called from a separate thread whenever a new packet arrived.

Example:

def callback(data):
    print data

# By providing a callback, a new thread would be spawned which
# would listen for data and call the given function
xbee = XBee(ser, callback=callback)

Original issue reported on code.google.com by [email protected] on 6 Jul 2010 at 3:29

'Unrecognized response packet with id byte \x92'

Hi,

Really looking forward to working with your library, was trying out but having 
trouble.

Have a simple coordinator and router reading adc on d0. It polls every 1sec.  
But when I try and read the frame, I will always get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\temp\python-xbee-f2b894f55529\examples\dispatch.py", line 61, in <module>
    dispatch.run()
  File "C:\Python27\lib\site-packages\xbee\helpers\dispatch\dispatch.py", line 58, in run
    self.dispatch(self.xbee.wait_read_frame())
  File "C:\Python27\lib\site-packages\xbee\base.py", line 400, in wait_read_frame
    return self._split_response(frame.data)
  File "C:\Python27\lib\site-packages\xbee\base.py", line 231, in _split_response
    "Unrecognized response packet with id byte {0}".format(data[0]))
KeyError: 'Unrecognized response packet with id byte \x92'


Any idea how to fix this?  Or what \x92 represents?


I am pretty certain I am using your latest.  Have tried multiple sample code 
and approaches, I always get this error.

Original issue reported on code.google.com by [email protected] on 6 Jan 2013 at 4:57

wait read frame return incorrect value

What steps will reproduce the problem?
1. manually set PAN ID of coordinator 
2. xbee.at(command='ID')
3. return value is not correct

What is the expected output? What do you see instead?
I set pan ID manually to 3332 but the return value from wait_read_frame is 
different (it was 32)

What version of the product are you using? On what operating system?
xbee 2.1, OS X 10.9.2

Please provide any additional information below.
return dictionary from wait_read_frame was somewhat weird:
{'status': '\x00', 'frame_id': '\x01', 'parameter': 
'\x00\x00\x00\x00\x00\x0032', 'command': 'ID', 'id': 'at_response'}

you can see parameter is weird -- it supposed to be 
\x00\x00\x00\x00\x00\x00\x33\x32.

I also noticed that return value from ND also contained weird value:
{'status': '\x00', 'frame_id': '\x01', 'parameter': {'status': '\x00', 
'source_addr': '\xda\x89', 'parent_address': '\xff\xfe', 'profile_id': 
'\xc1\x05', 'source_addr_long': '\x00\x13\xa2\x00@\xa93\x85', 'device_type': 
'\x01', 'node_identifier': 'XBEE2_MR', 'manufacturer': '\x10\x1e'}, 'command': 
'ND', 'id': 'at_response'}

@ mark in source addr long. 

Original issue reported on code.google.com by [email protected] on 6 Mar 2014 at 3:04

shell.py script is somewhat inconsistent between command mode and API mode

The shell.py script is currently a little odd. One may use it to conveniently 
send and receive data to an XBee device in command mode (data is not encoded in 
API frames). However, watch mode expects data to arrive as API frames; all else 
is ignored.

Is this the expected behavior for the simple shell script?

Original issue reported on code.google.com by [email protected] on 11 Jul 2010 at 7:09

XBee API escape support (AP=2)

Enable API escape support (AP=2) as an option.

Diff contents:
Added api_mode option to XBeeBase for API escape support.  api_mode defaults to 
1 for backward compatibility.  Set to 2 to enable escape support.  api_mode 
must be set the same as XBee radio AP option. 
Added two unit tests to test new api escape support. 
Fixed ieee import in several spots. 

If you want to give me write access to your Mercurial repo, I'd be happy to 
commit these directly.  If not, I'd be happy to just keep sending you patches. 
:)


Original issue reported on code.google.com by [email protected] on 19 Sep 2010 at 1:48

Attachments:

send and receive file

I sill have one question though; how can i stream or send files (images etc..) 
between two modules? I am using telegesis zigbee kit. And how do i prepare a 
transmitter (coordinator) and receiver (node)?

I would appreciate any help,

thanks in advance

Original issue reported on code.google.com by [email protected] on 17 Jul 2013 at 4:36

Do not clamp analog values to 0x3FF (ten bits), for V+ (including a Vcc sample)

The Vcc sample, in a sample set, should not be clamped to ten bits (0x3FF). 
This change removes clamping.

Using ZigBee modules: When automatically including the supply voltage level 
(see V+,  XBee Series 2 datasheet page 135), the sample value for the Vcc pin 
(bit 7 in the analog bit field, listed on page 96) is more than ten significant 
bits. The V+ documentation suggests the useful threshold value range is 
2100-3600 mV or 0x0700-0x0c00 for standard XBee modules, and the value I 
observe from the %V command is 0xD18 (3.928v).

I would expect the analog sample value from xbee-python to be 0xD18 (3.928v), 
but instead get 0x110 (at a slightly different time) which represents 0.319v. 
Removing the clamp should allow this larger value.

Original issue reported on code.google.com by [email protected] on 26 Aug 2012 at 11:03

Attachments:

XBee-1.9.0, setup.py auto tests do not run

What steps will reproduce the problem?
1. cd XBee-1.9.0
2. python setup.py install
3.

What is the expected output? 

  test scripts would auto run after install without err. 


What do you see instead?

Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from distutils_extensions import TestCommand, build_py
ImportError: No module named distutils_extensions


What version of the product are you using? On what operating system?
installed: xbee-1.9.0
installed: python 2.6 
installed: nose-0.11.4 
os:        xp sp3

Please provide any additional information below.

edited the setup.py to remark out 'from distutils_extensions..." and 'cmdclass' 
so the setup installed the new ver, just didn't auto run the test scripts.

docs.python.org, 11.API reference — Core Distutils functionality shows
distutils.extensions spelled distutils.extension. 

Original issue reported on code.google.com by [email protected] on 14 Jul 2010 at 11:44

Unify XBee Series 1 and 2.5 API interfaces

There are really two separate XBee tools here, one for traditional Series 1 and 
the other using the 
2.5 API protocol. It would be cool to write a common API for both (and others) 
so that switching 
from one radio to the other is a simple change in object initialization.

Original issue reported on code.google.com by [email protected] on 19 Jan 2009 at 11:42

to string crashes for any packet type other than IO data


The series 1 code only handles a single type of API frame, the IO data 
frame, with 16 bit addressing.

I've added in support for normal rx data in 16 bit addressing, as well as 
fixing the checksumming.  (it only logs, it could be made to raise an 
error?)

I've also added logging into the library.  If you don't do anything, 
nothing will happen unless you're in strict mode, as the default logging 
won't pick up anything below warn.

if you _do_ have logging though, you get a nice category of log output now.

(Yes, they probably should have all been added as individual diffs)

Original issue reported on code.google.com by [email protected] on 3 Mar 2010 at 7:43

Attachments:

escaped=False as default?

What steps will reproduce the problem?

1. Run my test program
2. The remote EP1 sends back data to the CO3 coordinator
3. Nothing is being displayed

What is the expected output? What do you see instead?

Some data coming back from EP1 should be displayed

What version of the product are you using? On what operating system?

XBee 2.0.0, Linux Kubuntu 10.10

Please provide any additional information below.

Seems the default is escaped=False (see base.by)
Changing this explicitely to escaped=True in the ZigBee(ser,..., escaped=True) 
now prints out data coming from the remote EP1.
Same for the (slightly modified) receive_samples_async.py example program: 
setting escaped=True made received packets be printed out.

Since API=2 (API mode, escaped characters) is set for xbee-api, I expected 
wrongly this is default here too. Is there a reason escaped=False by default?

Using this as default is fine for me now, but as before, an example program 
describing this parameter would be nice as otherwise the result is simply 
nothing being printed out, which looks like an utter failure, while in truth 
just a small parameter is missing.

The usual "Use the source, Luke" is of course the solution for this, and this 
is how I found out, but it's a tedious way, especially for non (resp. not-yet) 
Python users like me.

Original issue reported on code.google.com by [email protected] on 12 Feb 2011 at 2:17

Attachments:

xbee.send raises an AttributeError: 'Serial' object has no attribute '_write'

What steps will reproduce the problem?
Using xbee.send (tried it only with tx_long_addr) raises an AttributeError: 
'Serial' object has no attribute '_write'


What version of the product are you using? On what operating system?
- python-xbee 1.9.1
- PySerial 2.5
- Windows XP


Please provide any additional information below.
Modified base.py to change 'serial._write' to 'serial.write' as below:
    def _write(self, data):
        self.serial.write(APIFrame(data).output())

.. and so far seems to work ok.
Is this a bug?

Original issue reported on code.google.com by [email protected] on 17 Aug 2010 at 4:33

If the callback thread ends due to an exception, XBee.halt() will wait forever.

What steps will reproduce the problem?
1. Add a callback when creating an XBee object.
2. Unplug your XBee from the computer, causing an exception in 
XBee._wait_for_frame.
3. Arrange for your code to call halt() on your XBee object.

What is the expected output? What do you see instead?

The halt() method should return immediately (the thread has long since ended by 
exception). Instead, halt() waits forever for the _thread_quit event to be set.


What version of the product are you using? On what operating system?

2.0.0, Ubuntu 11.10


Please provide any additional information below.

I am attaching a patch that corrects this problem.

Original issue reported on code.google.com by [email protected] on 12 Apr 2012 at 11:22

Attachments:

How do I get the original node identifier?

I understand this forum is for bugs, but I don't know how else to ask 
questions. I recently saw lady-ada's watcher and she used this man's XBee-API.

http://www.ladyada.net/media/wattcher/xbee.py

Is this API built into your python-xbee package? if not, could this be added? 
Because right now, I have an output from by XBees where I can see their 
options, data, and some odds and ends but it would help if I could also get to 
see the origin node identifier, RSSI, etc.

Original issue reported on code.google.com by ronthecon on 14 Jun 2012 at 8:17

Calling isAlive() on a single-threaded XBee results in an AssertionError from threading.Thread

What steps will reproduce the problem?
1. xbee = XBee(serial.Serial('/dev/ttyUSB0', 9600))
2. xbee.isAlive()

Expected result:
 False (XBee was not created with a callback method, so a thread should not be running)

Actual result:
 AssertionError: Thread.__init__() not called.

Operating System, Package Version: Not specified

Original issue reported on code.google.com by [email protected] on 4 Aug 2010 at 7:40

can't send '}' character

What steps will reproduce the problem?
1. sender invoke: xbee.tx(dest_addr='\x00\x02', data = '}')
2. receiver : packet = xbee.wait_read_frame() 
3. receiver: print packet['rf_data']
What is the expected output? What do you see instead?
Expected output:
   receiver prints: '}'

What do I see:
  receiver print nothing. it is still waiting for packet. 

What version of the product are you using? On what operating system?
XBee API version 2.1. Operating System: Mac OSX Mountain Lion

Please provide any additional information below.
Whenever the data field of the xbee.tx(...) is not '}', it does what it soposed 
to do. I am trying to send a JSON packet over from xbee to xbee communication 
between two computers in python. 

Original issue reported on code.google.com by [email protected] on 31 May 2013 at 4:24

A small issue with installing the package

Sorry to keep posting here but I decided to get rid of Python 3.x for Python 
2.7 because wxWidgets is only compatible for 2.x and I have to use it for my 
program. So I installed Python 2.7 and pySerial, added C:\Python27 to my path, 
and went to the folder C:\Python27\XBee-2.0.0\ and ran:

python setup.py install

It supposedly installed correctly but then when I tried to run a simple script, 
it fell short with an import error.

Traceback (most recent call last):
  File "C:\Projects\RonakWaspmote\program\python\python27\gui.py", line 2, in <module>
    from xbee import DigiMesh
  File "C:\Python27\lib\site-packages\xbee\__init__.py", line 8, in <module>
    from xbee.ieee import XBee
ImportError: No module named ieee
>>> 

Is this because I still have multiple installations of Python on the computer? 
Python24, Python27, and Python32. Or is this because of some other reason?

I went to C:\Python27\XBee-2.0.0\xbee\ and there were no files with a *.pyc 
extension despite me running "python setup.py install" in the 
C:\Python27\XBee-2.0.0\ directory.

When I install the python-xbee API, this is my output:

C:\Python27\python-xbee>python setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
Removing C:\Python27\Lib\site-packages\XBee-2.0.0-py2.7.egg-info
Writing C:\Python27\Lib\site-packages\XBee-2.0.0-py2.7.egg-info

R

Original issue reported on code.google.com by ronthecon on 19 Jun 2012 at 6:43

ZigBee tx_long_addr

Hi,

I've been using this awesome lib for the last week in the receive mode 
(Raspberry PI acting as an XBee gateway, submitting data to a remote web 
service). Excellent work!

What steps will reproduce the problem?
1. Version 2.1.0 of lib
2. Code using ZigBee object rather than XBee object
3. Calling tx_long_addr

What is the expected output? What do you see instead?
Send data to a remote XBee

Stack trace is:

Traceback (most recent call last):
  File "./test2.py", line 23, in <module>
    main()
  File "./test2.py", line 15, in main
    zb.tx_long_addr(dest_addr=xbaddr, data="test")
  File "/usr/local/lib/python2.7/dist-packages/xbee/base.py", line 420, in __getattr__
    raise AttributeError("XBee has no attribute '%s'" % name)
AttributeError: XBee has no attribute 'tx_long_addr'


What version of the product are you using? On what operating system?
2.1.0, Python 2.7.4



Please provide any additional information below.


#! /usr/bin/python

import serial
from xbee import XBee, ZigBee
import sys


def main():
        ser = serial.Serial('/dev/ttyAMA0',9600)

        zb = ZigBee(ser, escaped=True)

        xbaddr = "\x00\x13\xA2\x00\x40\xA2\x5C\x50"

        zb.tx_long_addr(dest_addr=xbaddr, data="test")

        zb.halt()
        ser.close()



if __name__ == '__main__':
    main()

Background info:
All XBee's are series 2 (ZB)
Controller running API mode (receiving fine)
Number of endpoint XBee's running endpoint profile, AT mode

Original issue reported on code.google.com by [email protected] on 7 May 2014 at 9:32

Issue with information received on coordinator XBee

What steps will reproduce the problem?

1.using python-xbee (ver 2.1.0, or 2.0.0), pyserial latest version 2.6.0, 
Python 2.7.3 on Raspberry Pi running Debian Wheezy 7.0
2.run the script attached as file (XbeeR1.py)
3. All XBees are XB24-Z7-WIT-004 Series 2. The Co-ordinator is in API(1) mode. 
I tried my two sensor XBee's in both AT and API modes with no difference(notes 
on the firmware version is reflected as comments in the attached .py script)

What is the expected output? What do you see instead?

I expect the address received as result of the script to be the correct 
'source_addr_long', namely x13\xa2\x00\x40\x79\xe6\x5f, but instead I receive 
\x00\x13\xa2\x00@y\xe6.  The 'source_addr' returns \xe3+.  Also, the Node 
identifier does not come through correctly, yet the sensor samples are correct 
(and consistently so).  The attached file called output.txt is the result of 
the 'print data' line of code from one of the sensors, as received on the 
Raspberry Pi.

None of this makes sense.  The little I understand seems to tell me that I am 
parsing / processing the wrong information, or perhaps from the worn location 
in the data stream.  I worked through the libraries / modules (zigbee.py, etc.) 
but it is pretty foreign to me.

What version of the product are you using? On what operating system?

using python-xbee (ver 2.1.0, or 2.0.0), PySerial latest version 2.6.0, Python 
2.7.3 on Raspberry Pi Model B running Debian Wheezy 7.0 (upgraded to the latest 
version last night, in an attempt to address this matter.

Please provide any additional information below.
I am not a programmer, and therefore admit to being challenged in the code 
space already.  My electronics and IT knowledge is solid, however.  I have been 
battling for more than two weeks on this already.  When I use ZigBee Operator 
software, the addresses are sent and received properly.  Finally, it is quite 
possible that nothing is wrong with your library, I might just be buggering it 
up in code.

Regards,
Abrie

Original issue reported on code.google.com by [email protected] on 18 Jun 2013 at 12:39

Attachments:

Background thread crashes occasionally on faulty frame data

Hiho,

with an Arduino (or actually a Sense/Stage MiniBee [1]) attached to an XBee
sending data out, I occasionally get this error when it parses a faulty frame.
After this, the thread stops working alltogether, so it would be nice if it
were so robust to continue after this error.

sincerely,
Marije

Exception in thread Thread-3:
Traceback (most recent call last):
 File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
   self.run()
 File "/usr/local/lib/python2.6/dist-packages/xbee/base.py", line 94, in run
   self._callback(self.wait_read_frame())
 File "/usr/local/lib/python2.6/dist-packages/xbee/base.py", line 387, in
wait_read_frame
   frame = self._wait_for_frame()
 File "/usr/local/lib/python2.6/dist-packages/xbee/base.py", line 132, in
_wait_for_frame
   frame.fill(newbyte)
 File "/usr/local/lib/python2.6/dist-packages/xbee/frame.py", line 133, in
fill
   byte = chr(ord(byte) ^ 0x20)
TypeError: ord() expected a character, but string of length 0 found

Original issue reported on code.google.com by [email protected] on 28 Oct 2011 at 2:02

High-level interface needed

The classes available here are very low-level and require the user to have an 
AT command reference handy in order to make use of them.  A higher-level Python 
API is needed to expose these commands and arguments as native Python methods 
and data types.

For instance:

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

Could become:

    xbee.SetDigitalOutput(2, xbee.LOW, remote='5678')

I'm happy contributing such a thing, but it's not clear how/where such a layer 
would sit with the existing API.

Original issue reported on code.google.com by [email protected] on 12 May 2011 at 3:15

Examples for API mode?

All provided examples are using AT mode. API mode is by far more interesting 
and more useful, but unfortunately less easy to debug since it lacks an 
interactive and simple mode.

Is it possible to add a simple example, e.g. for the led_adc_example.py to use 
ZigBee instead of XBee? Setting an LED on a remore XBee and reading a remove 
ADC value is most useful and would provide a nice example.

Original issue reported on code.google.com by [email protected] on 11 Feb 2011 at 8:35

API Frame 0x82 not supported (64-bit addressing I/O sample)

This frame is not supported when it should be.

How to reproduce:
1. Set up an XBee device to send I/O samples periodically
2. Use 64-bit addressing
3. A KeyError exception 'Unrecognized response packet with id byte \x82' is 
raised.

Expected behavior:
An exception should not be raised, and the I/O samples within it should be 
properly parsed.

Original issue reported on code.google.com by [email protected] on 6 Jul 2010 at 10:17

Add automatic parsing of I/O data in IS at_response packets for ZigBee devices

At present, I/O data returned in the 'parameter' field of a remote_at_response 
is raw. To process this data into a usable form, one must call:

zb._parse_samples(packet['parameter'])

where zb is a ZigBee object, and packet is a valid remote_at_response for the 
IS AT command with a 'status' of 0x00.

This parsing should happen automatically, in a manner similar to periodic I/O 
data messages.

Original issue reported on code.google.com by [email protected] on 28 Oct 2011 at 2:00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.