I am able to get the QualifiedValue from system.opc.readValues for a list of itemPaths, but I only need to get the value. i can get only the value from the system.opc.readValue command using ‘.getValue’:
server = "KepwareServer"
path = "ns=2:s=Channel1.Device1.121.48.15"
qualifiedValue = system.opc.readValue(server, path)
print "Value: " + str(qualifiedValue.getValue())
How can this be done with the system.opc.readValues?
I’m not sure what you’re asking - it seems you’ve answered your own question.
edit: I see - readValue vs readValues
Just map the resulting list of QualifiedValues to values:
q_values = system.opc.readValues(...)
values = map(lambda qv: qv.getValue(), q_values)
q_values = system.opc.readValues(...)
values = [x.value for x in q_values]
[/code]Or even use it as a one-liner:values = [x.value for x in system.opc.readValues(...)]
Hope this helps.
{ I regularly use these shortcuts with system.tag.readAll() }