History Read
This section covers how to use the OPC UA History Read node to retrieve historical data from OPC UA servers.
Overview
The OPC UA History Read node enables you to:
- Read raw historical values stored on the server
- Retrieve aggregated data (averages, maximums, minimums, etc.)
- Access modified historical values
- Query data using flexible time specifications
- Process multiple variables efficiently
Historical data is essential for:
- Trend analysis and reporting
- Performance monitoring
- Quality control and auditing
- Predictive maintenance
- Compliance and documentation
Tutorials
Getting Started
- Reading Raw Historical Data - Retrieve raw historical values
- Reading Aggregated Data - Get server-calculated statistics
Working with Time
- Time Specifications - Use absolute and relative time ranges
Advanced Topics
- Reading Multiple Variables - Efficient multi-variable history reading
- Charting Historical Data - Visualize history in dashboards
- Error Handling - Handle errors and edge cases
Quick Reference
Read Last Hour (Raw Data)
msg.nodeId = "ns=2;s=Temperature";
msg.startTime = "1 hour ago";
msg.endTime = "now";
Read Daily Averages
msg.nodeId = "ns=2;s=Temperature";
msg.startTime = "7 days ago";
msg.endTime = "now";
msg.processingInterval = "1 day";
// Set node to: Processed Details, Aggregate: Average
Read Specific Date Range
msg.nodeId = "ns=2;s=Pressure";
msg.startTime = "2024-11-20T08:00:00Z";
msg.endTime = "2024-11-20T17:00:00Z";
Common Use Cases
- Trend Analysis: Read hourly/daily aggregates for long-term trends
- Reporting: Extract data for specific periods (shifts, days, months)
- Dashboards: Display recent history with real-time updates
- Quality Monitoring: Track process variables over time
- Compliance: Generate audit reports from historical records
- Troubleshooting: Investigate what happened during incidents
See Also
- Monitor Node - Subscribe to real-time data changes
- Read Node - Read current values
- Browse Node - Discover available variables