What is the protocol/method for a PC app. to communicate with the xbee mesh network?

Hello everyone,

I have to develop a temperature monitoring and control system using a ConnectPort X4 ZB - Ethernet gateway, a wall ZB router and 2 ZB end-devices (1 ZB RS232 Adapter + 1 micro-controller kit for each end-device, of course each end device has an additionnal HW such as t° sensor or IR tx module to pilote the air-conditionning).

I’ve read many threads on this forum and I know that I have to write a Python script which will be embedded in the ConnectPort X4 to manage my Xbee mesh network. Or I can extend the ‘zb_tcp_serial.py’ script to achive that. So now I assume that it’s OK for the communication between the elements in my mesh network (coordinator CPX4 and end devices).

But I have problem with the communication btw the CPX4 and my application running on a PC which has an internet connection. My purpose is to read the temperature value from an end device and send a command to another end device to pilote an air-conditionning (power on/off, increase/decrease t°, …).

Up to now, I dont know exactly what is the protocol for my app to be able to talk which the CPX4 or with the end devices. Some threads suggest to use telnet, others suggest to use XML-RPC library. I am going to write my application in C# or Java. So could anyone give me an advice? What seems to be suitable for my app? What should I do with the script on the CPX4? What should I do with my app?

Thanks so much for your helps

Hi,

Have you taken a look at using iDigi Dia for the application on the gateway? It is a python framework that provides a lot of useful ways to retrieve and present data, and you’d be able to incorporate your end devices into it by writing a device driver.

If you use this framework, it makes it would make it very easy to get data from your PC. If you want to take advantage of iDigi (which is a way you can tunnel requests to your device through the Internet easily), you will be able to make simple HTTP requests to get the current data, from any machine connected to the Internet. In this scenario, your application would look like this:

1.) X4 running iDigi Dia periodically pulls or gets pushed data from the ZB RS232 attached micro-controller.
2.) iDigi Dia stores this information in its channel data, which is just samples from the various devices it is configured for.
3.) Configure iDigi Dia to use the RCIHandler presentation, and make sure the device is connected to iDigi (may have to register for an account at idigi.com)
4.) Using your application, make an HTTP POST to http://{idigi-server-url}/ws/sci, with your username/password for iDigi, and specify this body:


 
  
    
  
  
    
      
         
      
    
  
 


And you will receive the current value of devices configured in iDigi Dia. This application can run on any internet connected machine and it will get to the device, given the device is connected.

If you know your application will always be able to access the X4 by IP, you can also go directly to the device, which would remove the requirement for an iDigi account.

In this scenario, steps 1 through 3 are the same, minus the requirement for the iDigi account and connection, and then you have to do:

4.) Do an HTTP POST to http://device-ip/UE/rci and supply:


  
    
      
    
  


And your application will similarly get back an XML representation of the devices configured in iDigi Dia. In this scenario you’ll have to manage your application knowing the X4’s address, and make sure that your application will always be able to talk directly to the X4 over the network.

This is one possibility, and there are likely a number of different ways you could get data between the PC and X4. Out of curiosity, is there any possibility you could just write the full application in python, and control the air conditioner without need to have the application running on a PC at all?

Chris

Thank you Chris but i’m novice to either python or Dia. For Python, I can learn myself. But for Dia, I dont know how to begin with. Could you please tell me what should I do on my CPX4 to make the Dia running? Thanks you in advance.

Hi,

At http://www.idigi.com/getstarted.jsp there is a video on getting started with iDigi Dia, you might want to watch that for a brief introduction.

After that you’ll have to register for iDigi to get access to the Dia and documentation, so click iDigi Platform Login. Once logged in you can click on the Documentation tab, which has the iDigi Dia Getting Started Guide and links to download versions of the Dia. There is also a link to download an eclipsed based IDE that is tailored to Dia development that you might give a try.

Chris

Thank you, I have another question: What is the Digi ESP used for?

Hello Zigbee_Man,

From the product description:

The Digi ESP for Python is a set of Python scripts, integrated IDE, samples and tools offered by Digi which have been designed to facilitate the development of Python and Dia applications for Digi devices.

When installed, you can create, run and debug Python and Dia projects in your device easily using the Integrated Development IDE called Digi ESP. It has an extensive documentation with a Getting Started guide and tutorials to create your first application from scratch. It also includes sample projects and other tools that simplify the Python and Dia development for Digi devices.

You can find the Windows installer here:
http://ftp1.digi.com/support/utilities/40002730_C.exe

Or, if you are a MAC user, this is your link:
http://ftp1.digi.com/support/utilities/40002731_C.dmg

Regards.

Thanks diegoe, I’ve installed it. But in my project I have my custom devices using Zigbee modules. So I have to write drivers for them and add them to the Gateway software. There are probable 2 solutions: modify the existing driver of the standard devices or write a new driver for my device, what should I do?

I have to develop an application like this, 5 xbee Pro S2 and gateway Connect Port x4 … you can help me … the setup of the configuration (msch topology) and the script pytho n on the gateway (coolect data from my network zigbee) …?

I can use Digi ESP for Python ?! it is free?! Is my data depends on “digi cloud” as XIG ?