I've been working on a project with Digi Xbee Series 2 (ZigBee) modules. I have a python script which receives the data on my coordinator device and saves it into a database. This script has been looking for and parsing the "samples" key in the returned data.
I've since bought a Digi XBee L/T/H sensor (http://www.digi.com/wiki/developer/index.php/XBee_Sensors) and have found that this returns the data using the "rf_data" key. This appears to be binary. I'm failing to be able to process it and read the actual values from it.
Can anyone tell me if I can re-program the sensor to send the "samples" key, or how to read/convert the binary data?
I've been trying to do it like this:
h=struct.unpack('f',response['rf_data'][0:4])[0]
But I'm out of my depth knowing exactly what I'm doing ;-)
Thanks in advance for any help you can give....
It's returning an I/O sample, as described in this Digi knowledge base article.
The page you linked to includes formulas for converting the ADC readings into temperature, humidity and light readings.
Section 3.2 of the python-xbee documentation seems to imply that I/O samples are parsed as of version 2.1. Make sure you're using that version, and see if you can access adc-1
through adc-3
of the I/O sample, and convert the readings to light, temperature and humidity values.