Uploading one numeric value from X2 to iDigi.

Hi,
I have one X2 that is registered and connected to iDigi.
The goal I want to achieve is to upload one numeric value from X2 to iDigi.
I’m running the following Digi example but the message it returns is :“Uploading device_stats0.xml to iDigi server…
Failed upload.
Please, wait 5 minutes…”

What I’m missing?Is there a better way/example to achieve this goal?

Thanks


“”"
iDigi stats example

THIS EXAMPLE WILL NOT FUNCTION EXCEPT ON DIGI DEVICES

This example sends device statistics to iDigi server every 5 minutes. 
They are stored into collection called "device_stats" and will send
a maximum of 10 files.

“”"

imports

import sys, os
import time

import the rci module to get access to the process_request method

import rci
import cStringIO

import this module to push up data files to the iDigi server the device

belongs to

from libs import idigi_data

sys.path.append(“WEB/python/libs.zip”)

constants

collection = “device_stats”
counter = 0
max_files = 10

while True:
# this is the rci request that will return device statistics
request = ’

# response will store the response from the rci request
response = rci.process_request(request)

# build XML string of the response
xml = cStringIO.StringIO()
xml.write("")
xml.write("")
xml.write(response)
xml.write("")
data = xml.getvalue()
xml.close()
# build file name
filename = "device_stats" + str(counter) + ".xml"
# push XML response to iDigi
print "Uploading %s to iDigi server..." % filename

try:
    success, error, errmsg= idigi_data.send_idigi_data (data, filename, \
                                                    collection,
                                                        secure=False)
    # validate upload
    if success:
        print "Successful upload.

"
else:
print "Failed upload.
"
except:
print "Failed upload.
"

# increase counter
counter += 1
if counter == max_files:
    counter = 0

# wait 5 minutes
print "Please, wait 5 minutes...

"
time.sleep(300)

Hello all,
many days haave been passed by and I’m not receiving any response to this thread.

Why?
Is there a problem?

Regards

Massimo

Hi,

Are you making this project from ESP for python? If yes, then check, whether in your project in libs, idigi_data.py is there?

And remove this sentence from your code, as dpdsrv.py (auto generated python script while running the project from ESP for python) would take care of it.

sys.path.append(“WEB/python/libs.zip”)

The zip file name would be _projectname.zip

I hope this will help.