History
ua.read_history(...) This simplifies the entry point; the complete version is directly API attached OpcUaSession to, and is named read_history_* / update_history / delete_history_*.
Subpage Redirect
- For a list of all origin points within the range, please refer to read_history (Raw).
- For a record of changes, please refer to read_history_modified.
- For interpolation at a specific point in time, please refer to read_history_at_time.
- Aggregation (Avg / Min / Max / TimeAverage / ...) Please refer to read_history_processed.
- Historical Events (Alarms / Conditions) — Please refer to read_history_events.
- For writing history (Insert / Replace / Update), please refer to update_history.
- For instructions on deleting history, please refer to delete_history_range.
5 Modes HistoryRead
| Pattern | API | Note |
|---|---|---|
| Raw Data | read_history | All points within the interval |
| Modified (includes revision history) | read_history_modified | The range contains modification records |
| AtTime A specific point in time | read_history_at_time | Interpolation for a Given Timestamp |
| Processed Aggregation | read_history_processed | Aggregation (Avg / Min / Max / ...) |
| Events History | read_history_events | Historical Events (Alarms / Conditions) |
HistoryUpdate
| API | Uses |
|---|---|
| update_history | Insert / Replace / Update / Remove Historical Data |
| delete_history_range | Delete History by Time Period |
Timestamp Convention
All input parameters API and return values are datetime UTC:
import datetime as dt
start = dt.datetime.now(dt.timezone.utc) - dt.timedelta(hours=1)
end = dt.datetime.now(dt.timezone.utc)
Do not transmit the local time (dt.datetime.now() default is local, no tzinfo). Internal SDK datetime → FILETIME conversions will force the processing UTC of naive times datetime.
General Prerequisites
- The server must support Historian; otherwise
OpcUaException, it throws an exception with status codeStatusCode.BadHistoryOperationUnsupported(the secure version doesread_history_safenot throw an exception; it returns(StatusCode, [])). - AccessLevel The HistoryRead bit (bit 2 / 0x04) and the bit HistoryWrite (bit 3 / 0x08) of the node must be set.
- The "Historizing Attribute" (20) node determines whether to record history.
- All historical methods areSynchronize, RPC Returns control to the calling thread; method-levelNo cancellation / timeout parameters (Constrained
request_timeout_msRPC by session-based parameters each time; default 5000 ms), large intervals can only be sliced on the business side
Companion entry points
ua.read_history_safe(...)—read_historySafe version, exception handling(StatusCode, []), no exception thrown- read_history_stream — Stream reading — Asynchronous generators yield items one by one to prevent the list from overflowing and causing a memory crash