Advanced Output or GUI for Python

Hello. I have just received my X4 started kit and have the XBee and XBee Pro sending voltage values back to my computer through DigiESP for Python. I have my code up and working, but the only output command I know to use it the “print” command.

I was wondering if there is a more advanced way to output into a real-time graph or chart. A GUI would be preferred, but real-time inputs are not required for my project.

I have gone through the forum and other sites and all I could find i 3rd Party applications for creating GUI. I have not yet tried these since I am unawared if it will be compatible with DigiESP

Hello keepreal1315,
If you have deployed your project using iDigi Dia Framework, Digi ESP has a tool called “Channels Explorer”. This tool allows the graphic representation over time of the different iDigi Dia Framework channels values in charts.

If this is not the case, I am afraid currently there is not any other way to represent values graphically in Digi ESP from an output.

Regards.

Thanks descalon, I had not seen anyone mention the channels explorer and it looks like it will be perfect for what i need.

I have my code inserted into the iDigi_pro_deckit sample that came with the software (I believe this is an iDigi_Dia framework code).

As of now, the values are being received from the two devices, converted into temperatures, and printed on the “iDigi_pro_devkit Console” as the output.

How do I code this output to be displayed in the Channels Explorer?

P.S. The core code is sensorlt.py which is calling all the values and outputting “sample(‘temperature’)” for both devices. Is there just a couple lines of code to add to make the channels explorer plot these values?

Hello keepreal1315,
I just realized, your code is just Python, I mean, you don’t have any iDigi Dia framework extension on it. Let me explain it a bit:

Dia refers to Device Integration Application. It is used to create remote monitoring and sensor network applications. It is written in the Python language and is fully extensible: You may easily add your own devices, presentations, code and modules. Dia is mainly compossed by three type of elements: Devices, Loggers and Presentations. These elements share information using what we call channels. Channels store information in real time, so it can be used by all Dia elements at any time. The information contained in channels can be of several types: boolean, numeric, string … and it is volatile; it can change anytime, for example when a new sample is retrieved.

Devices are basically drivers that communicate with physical or virtual devices to retrieve some kind of information and data. For example a XBee LT sensor Device retrieves light and temperature information from a remote XBee device. The device transforms this retrieved data and put it into channels to be used by other iDigi Dia elements. Data will be available on channels until it is updated because another sample has been taken. Devices may be virtual (for example a transform device or a XBee Manager Device) or physical (like the LT Sensor Device or the XBee DIO device).

Loggers elements store events that occur inside iDigi Dia Framework. For example, when value of one channel changes, a change event will be generated and logged inside iDigi Dia.

Presentation elements represent the information retrieved by the Devices and stored in channels in several ways. For example, a web presentation will start a web server in the device representing the information of all channels in html form. Another presentation is the RCIHandler, which allows external calls to the device to retrieve channel information in XML form (this is how the Channels Explorer works).

All the devices, loggers and presentations that will be running in an iDigi Dia framework are configured using the YML configuration file (dia.yml). Digi ESP provides a smart editor to add, remove and edit these elements in a graphic way. Dia elements may be configured using settings. Settings are read from the YML file and are used to instance and configure the Dia elements with specific values. For example, one common setting to be configured is the XBee node adress of an XBee device. Digi already offers several built-in standard Devices, Loggers and Presentations to be added to your iDigi Dia project.

Now that we have a bit of background about what is iDigi Dia:
In your case, Digi already provides a module to monitor temperaure of remote XBee LT sensors, it is called XBee Sensor. Now, what I recommend you is to create an empty standard Dia project. Open the YML file (dia.yml) and add a new devie to it. To do so, click on the Add… button of the YML editor. A new window will open. Select Devices from the left list and, in the right list select XBee Sensor. Back again in the YML editor, you will find that the new device is present. Now you will have to configure it. First set the XBee node address of the sensor (Mac address). Next, set the specific settings such as sample rate, sleep, humidity (in case it is Light/Temperature/Humidity sensor). See attached screenshot. Save the file and run the project. No additional code is required, it is all already embedded in the iDigi Dia framework. Once Dia project is running in the device, you will notice that there is no temperature output in the Python console. Thats right, temperature value is being read and represented in a channel of the XBee sensor.

It is time now to start Channel Explorer and consult data. To start it, click on the “Channels Explorer” main toolbar icon (see atached screen).

Once Channels Explorer is open it will automatically try to connect to the target and retrieve channel information. If connection was successful, all channels will be listed in the left side of the view. To look for a specific channel value over the time, just drag and drop the desired channel into the chart. Sampling will start automatically every 2 seconds.

To get specific information about Channels Explorer you can check the Digi ESP embedded help. Go to “Help” menu and click on “Help Contents”. Once there, select the book “Digi ESP for Python” at the left and expand it. Look for chapter 3 “Working with the IDE”, expand it and select topic 3.7 “Channel Explorer”.

Regards.

descalon,

I cannot thank you enough for the help. I have a lot on my plate righ now, but will let you know how it all turns out when I have the time to try this.

Thanks again.