Xstick to Ethernet

Hello,

Is there a python program to receive ZigBee data via Xstick and send it to internet?
Has anyone already implemented it?

Thanks,
Luciano

I have not seen such code. The easiest thing to do is just encapsulate pure API frames in a TCP socket. Or strip off the ‘length’ and BCC, just send the core message and have your Python code wrap on the 0x7E, length and BCC.

Not sure if this is what you are looking for, but I was trying to basically run python scripts that I had on my ConnectPorts on a PC or linux box and the following zigbee package (which is included in every connectport) allowed me to do just that.

ftp://ftp1.digi.com/support/sampleapplications/zigbee_py-for-PC.zip

The above download is intended for a PC with an XStick if I’m not mistaken, but I easily modified it to run on a linux box. This can turn your computer into a coordinator like a connectport but with way more horse power obviously and great for development if you put it on a laptop for instance. Good luck.

P.S.

Here was my post where I got the answer I was looking for:

http://forums.digi.com/support/forum/viewthread_thread,7697#23087

Hello Luciano,

Have you found an answer to your problem ?
I’m pretty much in the same case, I have a ConnectPortX2 and a XStick. I’d like to be able to send data (from a python script) to the XStick.

Thanks and Regards,
Luc

Thanks Lynn!
I will do a better research on this topic, If I find something I will post it later.

Hi, The python program depends upon on which operating system you are interfacing X Stick. Each OS has different ways to use the USB COM port. Like open COM port, receive/send data and close the COM port.

Then python code also depends on either you are using API or AT mode on X Stick. If you are using AT mode then remember each received data string at the COM Port will be separated by ‘\r’.

And to send over internet you can use either tcp sockets or udp sockets.

For serial ports on PC, the best solution is “pyserial” - and we even have this on the Digi gateway, so the same serial modules you create on a PC can work on the gateway (as long as other dependencies are kept out).

http://pyserial.sourceforge.net/

Hi Lynn,

Will this pyserial module will helf to use the usb vertual COM port on Win 32 based system? Like windows 7?

If yes, than how it is possible? What should be the COM port name? I am also facing issue with pyserial. Have you some idea on it? How to implement it?

My experience with pyserial is that it handles all serial ports under Windows 7. So for example, if my XBIB links in as COM13, then its name is just “COM13”. Now, I use the Windows style API, so the name “COM13”.

If you want to use POSIX/Linux style, the I believe it is off-by-one, so COM1 = 0 (or “/dev/ttyS0”, COM13 =12 and so on.

You can find the name under the "Control Panel > Device Manager > Ports (COM & LPT).

Note that the pyserial numbers don’t align with Python, so use the 2.5 even under 2.4.3 (because older pyserial only supported 10 serial ports).