Skip to main content

read_history_modified

If the server allows it (HistoryUpdate change history), the data may have been modified. read_history_modified Retrieve all versions and change logs for auditing and regulatory compliance purposes.

Preliminary / Supporting

Signature​

def read_history_modified(self,
node_id: str,
start_utc: datetime,
end_utc: datetime,
max_values: int = 0,
return_bounds: bool = False) -> List[OpcUaDataValue]: ...
ParametersDefaultNote
node_id—Target NodeId; Empty string exception ValueError
start_utc—Range starts at (UTC)
end_utc—Range Stop (UTC)
max_values0 (No limit)Maximum number of results per query
return_boundsFalseWhether to return the boundary values of the interval

Returns List[OpcUaDataValue]; each element is released with dv: using dispose() or.

Usage​

import datetime as dt

today = dt.datetime.now(dt.timezone.utc)
yesterday = today - dt.timedelta(days=1)

modified = ua.read_history_modified("ns=2;s=Temperature", yesterday, today)
for m in modified:
with m:
print(f"{m.source_timestamp.isoformat()}: {m.value} ({m.status.name})")
# Current SDK Exposes the underlying OpcUaDataValue; ModificationInfo (UserName/ModificationType/ModificationTime)
# It hasn't been revealed yet, so I can't tell "who made the change."

When to Use​

  • Regulatory Compliance: Regulated industries (pharmaceuticals, food, etc.) require "data traceability"
  • Audit Log: Who Changed the Key Parameters?
  • Data Recovery Rollback: Know what the value was before the change

Server Requirements​

  • Must be implemented HistoryUpdate
  • The revision history must be preserved (rather than overwritten).
  • User credentials must be passed correctly (Username / Certificate Token)

Next Step​