Exception while connecting CPX4 gateway from Digi ESP for Python


I use the example_serial_device.py as my custom end device’s driver and I tried to connect to my CPX4 from Digi ESP for Python to test this driver but I received this exception from the console:

[i]#> python dpdsrv.py

Launching Dia framework …

Determining platform type…Digi Python environment found.

Attempting to read “dia.pyr” in “WEB/python/dia.zip”…
iDigi Device Integration Application Version 1.2.19
Using settings file: dia.pyr
Core: initial garbage collection of 0 objects.
Core: post-settings garbage collection of 10 objects.
Starting Scheduler…
Starting Channel Manager…
Starting Device Driver Manager…

Exception during dynamic class load:
Traceback (most recent call last):
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\common\abstract_service_manager.py”, line 195, in service_load
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\common\classloader.py”, line 52, in classloader
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\devices\xbee\xbee_devices\xbee_serial_device.py”, line 99, in ?
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\devices\xbee\xbee_devices\xbee_serial_device.py”, line 106, in XbeeSer
NameError: name ‘PROD_DIGI_XB_ADAPTER_RS232’ is not defined

Exception during core initialization:
Traceback (most recent call last):
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\core\core_services.py”, line 235, in epoch
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\devices\device_driver_manager.py”, line 57, in init
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\common\abstract_service_manager.py”, line 105, in init
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\settings\settings_base.py”, line 175, in init
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\common\abstract_service_manager.py”, line 121, in apply_settings
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\common\abstract_service_manager.py”, line 148, in _reenumerate_service
File “C:\Program Files\Digi\DigiPython\Dia\Dia_1.2.19\src\common\abstract_service_manager.py”, line 200, in service_load
XBeeDeviceManager(xbee_device_manager): retrieving node list
ASMClassLoadError: unable to load ‘devices.xbee.xbee_devices.xbee_serial_device:XbeeSerialDevice’: exceptions.NameError:name ‘PROD
_DIGI_XB_ADAPTER_RS232’ is not defined
CoreServices: fatal exception caught! Halting execution.[/i]

Could anoyone tell me what can be the source of this exception? Thanks!

Looking at the xbee_serial_device.py file, it appears to be missing an important import.

You should add this to the list of imports at the top of the file:

from devices.xbee.common.prodid import PROD_DIGI_XB_ADAPTER_RS232,

Thanks so much scottk! I works like that! Found that you have experienced with Python and Dia, I wonder if you could give me some ideas:

  1. Which data frame (btw 0x10 and 0x11) to be sent from my custom device (with a Xbee ZB module) to the CPX4 gateway?

  2. If the 0x11 is selected, what values should I use for these fields in the frame: source endpoint, destination endpoint, cluster ID and profile ID?

Again, thanks so much for your help!

I answer for myself: I use the 0x10 frame with default values of source endpoint, destination endpoint, cluster ID and profile ID.