ConnectPort X Test Code

I’ve attached the test software I wrote to connect to a Zigbee-based Brultech ( ECM-1220 Power monitor via a ConnectPort X2 from another host on the network. What I assume is of primary interest here is that the program polls the ConnectPort X2 Control Port via XML-RPC, finds ECM-1220’s assigned TCP port by its Zigbee NodeID, and connects to the device. The code assumes that the desired Zigbee device has already been discovered via the X2’s web interface, so I’m just enumerating devices rather than discovering them.

The ECM-1220 just sends our data packets and has no command/rsponse protocol, so there’s a lot of code that deals with it’s idiosyncracies. On the other hand, the basic ideas of determining a Zigbee device’s TCP port should be of interest to others.

I consider the code to be GPL, and will most likely publish it to my Web site ( in the future. I’m not a great programmer, so please forgive my excessive comments and non-elegant code.

Thanks to JordanH for his help and understanding with my dumb questions.




Hi Tim,

Thanks for posting the code. To encourage uptake by the python community, you might consider tweaking it to conform with generally-accepted python style. A good reference is Guido - Benevolent Dictator for Life - Rossum’s essay, This goes a long way towards making code easily readable by others.


Hi Tim,

I read your code and it is most useful. I am learning from it.

I have a problem, however.

I have a Connectport X2 (WiFi) and it consistently refuses connections on port 27000. I always get error 10061 - ‘Connection Refused’. As a result, the gateway viewer sample also does not work. Am I missing a firmware upgrade or something?

I am running WinXP - SP3.

Hola Aks.

Perhaps, that is a firewall related problem on the port or on the ip address. Check for other applications using that port.

Sorry I didn’t answer sooner. Haven’t had much reason to check in lately.

One thing I forgot to mention is that the program requires the to be running on the ConnectPort to map Zigbee Devices to TCP ports. It also provides the XMLRPC interface.

In the “Digi Python Scripts” forum, you’ll find several posts about how to obtain and install the Python packages. There are a few with download links.

After installing them, I set the ConnectPort to “Auto-Start” After setting this and rebooting the ConnectPort, it should answer on Port 27000.

Hope it helps!