python’s dir() and my inspect.introspect() functions are your best friends in these cases. But note that the docs for readRaw() don’t say that what you think is a QV is actually a QV. The docs imply you need one more level of dereferencing, though they aren’t very clear.
Yeah I wasn’t even reverse engineering - just poking about and seeing what might work. Not ideal but I managed to get it going.
OPC-HDA is a bit obscure but the docs really need a tidy up - lots of outright wrong information in that section and, like you say, implying but not telling
def browse(OPCHDA_Server, path, boundingValues, startDate, endDate, maxValues):
logger = system.util.getLogger("myLogger")
Logging = False
for result in system.tag.browseHistoricalTags(path).getResults():
#List of historical tags
result_path = str(result.getPath())
if result_path.endswith('.Voltage') :
itemId = result_path.split('/tag:')[1]
itemIds = [itemId]
SiteName = itemIds[0].split('.')[2]
Measurement = '.'
Measurement = Measurement.join(itemIds[0].split('.')[3:])
ReadResults = system.opchda.readRaw(OPCHDA_Server, itemIds, startDate, endDate, maxValues, boundingValues)
for qualifiedValues in ReadResults:
for qualifiedValue in qualifiedValues.getValues():
if Logging:
logger.info( SiteName + ', ' + Measurement + ', ' + str(qualifiedValue.getValue()) + ', ' + str(qualifiedValue.getTimestamp()))
if result.hasChildren():
browse(OPCHDA_Server, result.getPath(), boundingValues, startDate, endDate, maxValues)
So this will periodically drill through all the HDA tags in the OPCHDA server and get the values for any tag that ends with “.Voltage” for the last 24 hours.