Publishing Events
Once you've processed data, you can share it back with VergeLink. This section will explain how to report your data type and publish your results.
To publish your processed data, you need to report the data model so that Vergelink knows what type of data you have. Then, use the publish function.
reportDataPointMetaData
VL.reportDataPointMetadata = () => {
return [{ name: 'Datatype_Name', variable_type: 'FLOAT', unit: '°C' }];
};
Allowed variable_type
Values
"BOOLEAN"
"INT8"
"INT16"
"UINT16"
"INT32"
"UINT32"
"INT64"
"UINT64"
"FLOAT"
"DOUBLE"
"STRING"
"DATE_TIME"
"BYTE"
publishMeasurements
VL.publishMeasurements(
[{ name: '<dataPointName>', value: '<value>' }],
new Date().toISOString()
);
Make sure the datatype_name you are using has been reported already.
Example
VL.subscribeFile = (data) => {
VL.publishMeasurement(`Temperature`, data[0]);
};
VL.reportDataPointMetadata = () => {
return [{ name: 'Temperature', variable_type: 'FLOAT', unit: '°C' }];
};