FreeOpcUa / python-opcua

LGPL Pure Python OPC-UA Client and Server
http://freeopcua.github.io/
GNU Lesser General Public License v3.0
1.32k stars 661 forks source link

History Read Error #1492

Open sprasoon opened 1 year ago

sprasoon commented 1 year ago

I am reading several nodes from opcua server. No issues reading single variable values using self.opcua.get_value(nodes) but when I trying to read history values I get an error "History Read Error: 'ExtensionObject' Object has no attribute 'DataValues'. Verified on UAExpert that the history data is available for the node of interest. Python version 3.10.2 on mac.

code:

starttime = "21.11.2022 08:09:09" starttime_dt_format = datetime.datetime.strptime(starttime,"%d.%m.%Y %H:%M:%S")
endtime = "21.11.2022 08:15:09" endtime_dt_format = datetime.datetime.strptime(endtime,"%d.%m.%Y %H:%M:%S")
thisnode = self.opcua.client.get_node("ns=2;s=OPCNode.TSInt32Random") data = await thisnode.read_raw_history(starttime=starttime_dt_format, endtime=endtime_dt_format, numvalues=20) #<-- This line returns error

MicrosoftTeams-image (4)

alexander-travov commented 1 year ago

In screenshot NodeId is "ns=4;s=OPCNode.TSInt32Random", in script you use ns=2.

Maybe this is the issue?