Skip to main content
Version: 8.1

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​

TypeParameterDescription
StringopcServerThe name of the OPC server connection in which the item resides.
StringitemPathThe 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​

Code Snippet
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()