system.opc.readValue
This function is used in Python Scripting.
Descriptionβ
Reads a single value directly from an OPC server connection. The address is specified as a string, for example, [MyDevice]N11/N11:0The object returned from this function has three attributes: value, quality, and timestamp. The value attribute represents the current value for the address specified.
The quality attribute is an OPC UA status code. You can easily check a good quality vs a bad quality by calling the isGood() function on the quality object. The timestamp attribute is Date object that represents the time that the value was retrieved at.
Client Permission Restrictionsβ
This scripting function has no Client Permission restrictions.
Syntaxβ
system.opc.readValue(opcServer, itemPath)
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| String | opcServer | The name of the OPC server connection in which the item resides. |
| String | itemPath | The item path, or address, to read from. |
Returnsβ
QualifiedValue - A QualifedValue object that contains the value, quality, and timestamp returned from the OPC server for the address specified.
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
server = "Ignition OPC UA Server"
path = "[SLCSim]_Meta:N7/N7:0"
qualifiedValue = system.opc.readValue(server, path)
print "Value: " + str(qualifiedValue.getValue())
print "Quality: " + qualifiedValue.getQuality().toString()
print "Timestamp: " + qualifiedValue.getTimestamp().toString()