This project reads tag values from an OPC UA server and logs them into a SQLite database at a configurable interval. Tag details are loaded from a CSV file, and all configuration is managed via a JSON config file.
server.js
— Main script for reading OPC UA data and logging to SQLiteconfig.json
— Configuration file for endpoint, credentials, polling interval, database/table, and CSV filetags.csv
— CSV file listing tag names and nodeIds to readopcua_data.db
— SQLite database file (default name, configurable)Edit config.json
to set your parameters:
{
"opcuaEndpoint": "opc.tcp://localhost:4840",
"opcuaUsername": "", // optional
"opcuaPassword": "", // optional
"sqliteDbName": "opcua_data.db",
"sqliteTableName": "tag_data",
"pollIntervalMs": 1000,
"tagsCsvFile": "tags.csv"
}
Example tags.csv
:
name,nodeId
Constant,ns=3;i=1001
Counter,ns=3;i=1002
Random,ns=3;i=1003
npm install
node server.js
config.json
.34.03$