diff --git a/src/configs/machineGroupControl.json b/src/configs/machineGroupControl.json index 95f5ac3..df407b4 100644 --- a/src/configs/machineGroupControl.json +++ b/src/configs/machineGroupControl.json @@ -134,6 +134,7 @@ "type": "enum", "values": [ { "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." }, + { "value": "frost", "description": "FROST/SensorThings CoreSync payload." }, { "value": "json", "description": "Raw JSON payload." }, { "value": "csv", "description": "CSV-formatted payload." } ], diff --git a/src/configs/measurement.json b/src/configs/measurement.json index c8eb188..2d2652e 100644 --- a/src/configs/measurement.json +++ b/src/configs/measurement.json @@ -120,6 +120,7 @@ "type": "enum", "values": [ { "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." }, + { "value": "frost", "description": "FROST/SensorThings CoreSync payload." }, { "value": "json", "description": "Raw JSON payload." }, { "value": "csv", "description": "CSV-formatted payload." } ], @@ -512,4 +513,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/configs/pumpingStation.json b/src/configs/pumpingStation.json index 793053b..d126de2 100644 --- a/src/configs/pumpingStation.json +++ b/src/configs/pumpingStation.json @@ -166,6 +166,10 @@ "value": "influxdb", "description": "InfluxDB telemetry payload." }, + { + "value": "frost", + "description": "FROST/SensorThings CoreSync payload." + }, { "value": "json", "description": "JSON payload." diff --git a/src/configs/rotatingMachine.json b/src/configs/rotatingMachine.json index 36e92aa..dc00374 100644 --- a/src/configs/rotatingMachine.json +++ b/src/configs/rotatingMachine.json @@ -134,6 +134,7 @@ "type": "enum", "values": [ { "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." }, + { "value": "frost", "description": "FROST/SensorThings CoreSync payload." }, { "value": "json", "description": "Raw JSON payload." }, { "value": "csv", "description": "CSV-formatted payload." } ], diff --git a/src/helper/formatters/frostFormatter.js b/src/helper/formatters/frostFormatter.js new file mode 100644 index 0000000..0393f80 --- /dev/null +++ b/src/helper/formatters/frostFormatter.js @@ -0,0 +1,23 @@ +/** + * FROST handoff formatter + * ----------------------- + * Keeps the same structured envelope as the InfluxDB formatter so a shared + * CoreSync collector can accept existing EVOLV dbase messages without coupling + * producing nodes to FROST HTTP details. + */ +function format(measurement, metadata) { + const { fields, tags, config } = metadata; + return { + measurement, + fields, + tags: tags || {}, + timestamp: new Date().toISOString(), + source: { + nodeId: config?.general?.id, + softwareType: config?.functionality?.softwareType, + unit: config?.general?.unit || config?.asset?.unit, + }, + }; +} + +module.exports = { format }; diff --git a/src/helper/formatters/index.js b/src/helper/formatters/index.js index 9d57313..29f00ec 100644 --- a/src/helper/formatters/index.js +++ b/src/helper/formatters/index.js @@ -14,6 +14,7 @@ const influxdbFormatter = require('./influxdbFormatter'); const jsonFormatter = require('./jsonFormatter'); const csvFormatter = require('./csvFormatter'); const processFormatter = require('./processFormatter'); +const frostFormatter = require('./frostFormatter'); // Built-in registry const registry = { @@ -21,6 +22,7 @@ const registry = { json: jsonFormatter, csv: csvFormatter, process: processFormatter, + frost: frostFormatter, }; /**