Home  >  Support  >  Support Forum  >  How to get a ConnectPort's uniqueID via Python
Notice! We've recently migrated to using a new forum, we hope you enjoy it. If you are an existing member and this is your first time visiting our new forum, please reset your password to be able to sign in.
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to get a ConnectPort's uniqueID via Python

0 votes
I need to get the DeviceID from a ConnectPort from within a Python program. This program is installed on X2, X3 and X2e product, I don't want to maintain different script depending on hardware. The main goal behind this is for the ConnectPort to "checkin" within my service to let me know it is connected via a TCP server and need to identify itself.

I used to be able to do it via digicli, which is not available in many recent ConnectPort, such as X2e

I can read the ethernet port and get the mac adress and assume this as a unique id, but then my X3's I have in the field wont be working properly as no ethernet port is present.

I looked into xbee.ddo_get_param(None, 'SL' -or 'SH') but my X2e product only return gibberish.
Here is the script :
serialhigh = xbee.ddo_get_param(None, 'SH')
seriallow = xbee.ddo_get_param(None, 'SL')
print "INFO: DeviceId found (sh) : " + str(serialhigh)
print "INFO: DeviceId found (sl) : " + str(seriallow)

Printed info is :
INFO: DeviceId found (sh) : ¢
INFO: DeviceId found (sl) : @™_¹

I tried the RCI module:
with <rci_request><query_state/></rci_request> I have to write a very complex method to be able to get a simple line of information.
with <do_command target="zigbee">
<discover start="1" size="1" option="clear"/>
</do_command>, I have the same issue as with the query state.

Isn't there an easy way to access the device id from the Python engine ?
asked Dec 23, 2013 in 3rd Party Python and API development in other Languages by gjasmin New to the Community (0 points)

Please log in or register to answer this question.

2 Answers

0 votes
- One way to list all the devices in your account is /ws/DeviceCore /sci GET request.
- Are you referring to this, http://www.digi.com/wiki/developer/index.php/Module:zigbee ?
- With what information you need to get device ID of a device?
- X2e do not support Modules:digicli, digiweb, digiwdog etc.

Please provide all these information which would help in understanding your requirement.

Regards!!
answered Jan 7 by 16ksa23 Veteran of the Digi Community (369 points)
1- As mentionned, I'm trying to get the DeviceId via python, not via Etherios. Etherios is out of the picture and never will be.
2- I did use the example on that link you provided without success.
3- I'm not sure of your question, but here's the answer to what I think you mean: I'm using a python application for various task and once an hour this python app need to checkin to my server to confirm it is alive and well. I want to use the uniqueID of the device for that checkin.
4- I know it does not support these modules, that's what I'm stating in my question.
0 votes
I received the following from digi support:

Using RCI:

import rci

response = rci.process_request('<rci_request version="1.1"> <query_state/> </rci_request>')

LANposition = response.find('<mac>')
DigiMAC = response[LANposition+5:LANposition+22]


This returns the ethernet MAC of the device. It works on X2 and X2e variants.
answered Mar 24 by Greg Vaudreuil New to the Community (1 point)
Your M2M Expert™for Businessfor Developers
Newsletter SignupYouTubeGoogle+FacebookCopyright © 1996-2013 Digi International Inc. All rights reserved. Legal
...