{"id":22859969,"url":"https://github.com/reelyactive/barnacles-opcua","last_synced_at":"2025-08-30T18:11:15.102Z","repository":{"id":241025280,"uuid":"804100171","full_name":"reelyactive/barnacles-opcua","owner":"reelyactive","description":"Distribute ambient IoT sensor data from Pareto Anywhere open source middleware via an OPC-UA server.  We believe in an open Internet of Things.","archived":false,"fork":false,"pushed_at":"2025-03-13T00:11:43.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T08:29:27.238Z","etag":null,"topics":["iot","opc-ua","opc-ua-server","pareto-anywhere"],"latest_commit_sha":null,"homepage":"https://www.reelyactive.com/pareto/anywhere/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reelyactive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-22T00:36:11.000Z","updated_at":"2025-03-13T00:11:47.000Z","dependencies_parsed_at":"2024-06-26T17:24:45.213Z","dependency_job_id":"b2dab971-e072-4b96-bad4-0965b4071d50","html_url":"https://github.com/reelyactive/barnacles-opcua","commit_stats":null,"previous_names":["reelyactive/barnacles-opcua"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles-opcua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles-opcua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles-opcua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles-opcua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reelyactive","download_url":"https://codeload.github.com/reelyactive/barnacles-opcua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251754195,"owners_count":21638468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["iot","opc-ua","opc-ua-server","pareto-anywhere"],"created_at":"2024-12-13T09:08:33.028Z","updated_at":"2025-08-30T18:11:15.095Z","avatar_url":"https://github.com/reelyactive.png","language":"JavaScript","funding_links":["https://opencollective.com/node-opcua"],"categories":[],"sub_categories":[],"readme":"barnacles-opcua\n===============\n\n__barnacles-opcua__ is an OPC UA server of IoT data from ambient wireless sensors.  [reelyActive](https://www.reelyactive.com) is an [OPC UA logo member](https://opcfoundation.org/members/view/7804).\n\n![Overview of barnacles-opcua](https://reelyactive.github.io/barnacles-opcua/images/overview.png)\n\n__barnacles-opcua__ ingests a real-time stream of _dynamb_ objects from [barnacles](https://github.com/reelyactive/barnacles/), converting their properties into standard OPC UA format.  It couples seamlessly with reelyActive's [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source IoT middleware.\n\n__barnacles-opcua__ is a lightweight [Node.js package](https://www.npmjs.com/package/barnacles-opcua) that can run on resource-constrained edge devices as well as on powerful cloud servers and anything in between.\n\n\nPareto Anywhere integration\n---------------------------\n\nA common application of __barnacles-opcua__ is to publish IoT data from [pareto-anywhere](https://github.com/reelyactive/pareto-anywhere) via an OPC UA server.  Simply follow our [Create a Pareto Anywhere startup script](https://reelyactive.github.io/diy/pareto-anywhere-startup-script/) tutorial using the script below:\n\n```javascript\n#!/usr/bin/env node\n\nconst ParetoAnywhere = require('../lib/paretoanywhere.js');\n\n// Edit the options to customise the server\nconst BARNACLES_OPCUA_OPTIONS = {};\n\n// ----- Exit gracefully if the optional dependency is not found -----\nlet BarnaclesOPCUA;\ntry {\n  BarnaclesOPCUA = require('barnacles-opcua');\n}\ncatch(err) {\n  console.log('This script requires barnacles-opcua.  Install with:');\n  console.log('\\r\\n    \"npm install barnacles-opcua\"\\r\\n');\n  return console.log('and then run this script again.');\n}\n// -------------------------------------------------------------------\n\nlet pa = new ParetoAnywhere();\npa.barnacles.addInterface(BarnaclesOPCUA, BARNACLES_OPCUA_OPTIONS);\n```\n\nSupported Properties\n--------------------\n\n__barnacles-opcua__ currently supports the following properties, in alphabetical order:\n\n| OPC UA browseName          | OPC UA dataType | dynamb property            |\n|:---------------------------|:----------------|:---------------------------|\n| AccelerationTimeSeriesX    | YArrayItem      | accelerationTimeSeries     |\n| AccelerationTimeSeriesY    | YArrayItem      | accelerationTimeSeries     |\n| AccelerationTimeSeriesZ    | YArrayItem      | accelerationTimeSeries     |\n| CarbonDioxideConcentration | AnalogDataItem  | carbonDioxideConcentration |\n| Illuminance                | AnalogDataItem  | illuminance                |\n| PM1.0                      | AnalogDataItem  | pm1.0                      |\n| PM2.5                      | AnalogDataItem  | pm2.5                      |\n| PM10                       | AnalogDataItem  | pm10                       |\n| Pressure                   | AnalogDataItem  | pressure                   |\n| RelativeHumidity           | AnalogDataItem  | relativeHumidity           |\n| SoundPressure              | AnalogDataItem  | soundPressure              |\n| Temperature                | AnalogDataItem  | temperature                |\n| VelocityOverallX           | AnalogDataItem  | velocityOverall            |\n| VelocityOverallY           | AnalogDataItem  | velocityOverall            |\n| VelocityOverallZ           | AnalogDataItem  | velocityOverall            |\n| VolatileOrganicCompoundsConcentration | AnalogDataItem  | volatileOrganicCompundsConcentration |\n\nAdditional [dynamb properties](https://reelyactive.github.io/diy/cheatsheet/#dynamb) will be added in future.  Helpful [node-opcua API documentation](https://node-opcua.github.io/api_doc/) references for adding items:\n- [AddAnalogDataItemOptions](https://node-opcua.github.io/api_doc/2.132.0/interfaces/node_opcua.AddAnalogDataItemOptions.html)\n- [AddYArrayItemOptions](https://node-opcua.github.io/api_doc/2.132.0/interfaces/node_opcua.AddYArrayItemOptions.html)\n\n\nQuick Start\n-----------\n\nClone this repository, then from its root folder, install dependencies with `npm install`.  Start the OPC-UA server with the following command:\n\n    npm start\n\nand connect an OPC-UA client (see examples below) on port __4840__ and resource path __/UA/ParetoAnywhere__.  Note that no device data will be available without a source of [dynamb](https://reelyactive.github.io/diy/cheatsheet/#dynamb) data, for example from [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source IoT middleware.\n\nTo validate _secure_ communication, simply provide a certificate and private key as [config files](#config-files).\n\n\nSimulated Data\n--------------\n\nThe following simulated devices/sensors are supported for interface testing.\n\n### EnOcean EMSIB\n\nTo simulate an [EnOcean EMSIB](https://www.enocean.com/en/product/stm-550-kit/) multisensor, start __barnacles-opcua__ with the following command:\n\n    npm run enocean-emsib\n\nSimulated sensor `browseName = \"e500100e851b/3\"` will expose the following variables:\n\n| OPC UA browseName | OPC UA dataType |\n|:------------------|:----------------|\n| Illuminance       | AnalogDataItem  |\n| RelativeHumidity  | AnalogDataItem  |\n| Temperature       | AnalogDataItem  |\n\n\n### HibouAir CO2 Noise Sensor\n\nTo simulate a [HibouAir CO2 Noise](https://hibouair.com/air-quality-monitor-co2-noise-sensor.php) air quality sensor, start __barnacles-opcua__ with the following command:\n\n    npm run hibouair-co2noise\n\nSimulated sensor `browseName = \"41b00a14c024/3\"` will expose the following variables:\n\n| OPC UA browseName                     | OPC UA dataType |\n|:--------------------------------------|:----------------|\n| CarbonDioxideConcentration            | AnalogDataItem  |\n| Pressure                              | AnalogDataItem  |\n| RelativeHumidity                      | AnalogDataItem  |\n| SoundPressure                         | AnalogDataItem  |\n| Temperature                           | AnalogDataItem  |\n| VolatileOrganicCompoundsConcentration | AnalogDataItem  |\n\n\n### HibouAir PM Sensor\n\nTo simulate a [HibouAir PM](https://hibouair.com/specifications-air-quality-monitor-pm-sensor.php) air quality sensor, start __barnacles-opcua__ with the following command:\n\n    npm run hibouair-pm\n\nSimulated sensor `browseName = \"41b00a145977/3\"` will expose the following variables:\n\n| OPC UA browseName                     | OPC UA dataType |\n|:--------------------------------------|:----------------|\n| Illuminance                           | AnalogDataItem  |\n| PM1.0                                 | AnalogDataItem  |\n| PM2.5                                 | AnalogDataItem  |\n| PM10                                  | AnalogDataItem  |\n| Pressure                              | AnalogDataItem  |\n| RelativeHumidity                      | AnalogDataItem  |\n| Temperature                           | AnalogDataItem  |\n| VolatileOrganicCompoundsConcentration | AnalogDataItem  |\n\n\n### Sensor-Works BluVib\n\nTo simulate a [Sensor-Works BluVib](https://www.sensor-works.com/products/) industrial vibration sensor, start __barnacles-opcua__ with the following command:\n\n    npm run sensorworks-bluvib\n\nSimulated sensor `browseName = \"5e4504b1071b/3\"` will expose the following variables:\n\n| OPC UA browseName       | OPC UA dataType |\n|:------------------------|:----------------|\n| Temperature             | AnalogDataItem  |\n| AccelerationTimeSeriesX | YArrayItem      |\n| AccelerationTimeSeriesY | YArrayItem      |\n| AccelerationTimeSeriesZ | YArrayItem      |\n| VelocityOverallX        | AnalogDataItem  |\n| VelocityOverallY        | AnalogDataItem  |\n| VelocityOverallZ        | AnalogDataItem  |\n\n\nObserving Data with opcua-commander\n-----------------------------------\n\nThe [opcua-commander](https://github.com/node-opcua/opcua-commander) CLI, based on the same [node-opcua](https://github.com/node-opcua/node-opcua) open source package used by __barnacles-opcua__, provides a simple means of browsing and monitoring the OPC-UA data.\n\nAfter installing [opcua-commander](https://github.com/node-opcua/opcua-commander), open a terminal and browse to the __barnacles-opcua__ server with the following command:\n\n    opcua-commander -e opc.tcp://localhost:4840\n\nUse the arrow keys and the t / l / i / c / u / s / a keys to navigate through the CLI interface, and use the x key to close.\n\n\nObserving Data with UaExpert\n----------------------------\n\nUnified Automation offers [UaExpert](https://www.unified-automation.com/products/development-tools/uaexpert.html), a full-featured Windows/Linux OPC UA client, for [free download](https://www.unified-automation.com/downloads/opc-ua-clients.html), with registration.\n\n\nConfig Files\n------------\n\nThe __/config__ folder accepts the following run-time configuration files:\n- __certificate.pem__ (security certificate)\n- __key.pem__ (private key)\n\nAlternatively, these can be specified in the [Options](#Options).\n\n\nSecurity Certificate\n--------------------\n\n__barnacles-opcua__ does _not_, by default, implement a secure OPC-UA server.  This facilitates testing in a local sandbox environment.  In any other environment, the use of an [Application Instance Certificate](https://reference.opcfoundation.org/Core/Part6/docs/6.2.2) is essential for secure operation.\n\nWhen creating the security certificate, for example using OpenSSL, ensure that the following properties are included and correctly entered for compliance with the OPC UA specification.\n\n| Property             | Example                      | Description            | \n|:---------------------|:-----------------------------|:-----------------------|\n| subjectAltName       | urn:machine:NodeOPCUA-Server | Application URI        |\n| commonName (CN)      | Pareto Anywhere              | Name of the product    |\n| organizationName (O) | Your organisation            | Operator of server     |\n\nThe Node-OPCUA server will output warnings when a certificate is present but not compliant, for example:\n\n    \"The certificate subjectAltName uniformResourceIdentifier is missing.\"\n    \"Please regenerate a specific certificate with a uniformResourceIdentifier that matches your server applicationUri\"\n    \"applicationUri  = urn:machine:NodeOPCUA-Server\"\n\nIt is up to the user to generate and validate compliant security certificates.\n\n\nCreating a Self-Signed Certificate for OPC-UA using OpenSSL\n-----------------------------------------------------------\n\nIn a development environment, it is common for __barnacles-opcua__ to run on the same local network as OPC UA client.  A self-signed server certificate (for __barnacles-opcua__) and the CA certificate can be generated with OpenSSL using the following procedure:\n\n### Create a server.cnf file\n\n```\n[req]\ndefault_bits  = 2048\ndistinguished_name = req_distinguished_name\nreq_extensions = req_ext\nx509_extensions = v3_req\nprompt = no\n\n[req_distinguished_name]\ncountryName = CA\nstateOrProvinceName = QC\nlocalityName = Montreal\norganizationName = reelyActive\ncommonName = Pareto Anywhere\ndomainComponent = machine\n\n[req_ext]\nsubjectAltName = @alt_names\nkeyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment\nextendedKeyUsage = serverAuth, clientAuth\n\n[v3_req]\nsubjectAltName = @alt_names\n\n[alt_names]\nURI.1 = urn:machine:NodeOPCUA-Server\n```\n\nUpdate the domainComponent and URI.1 fields, replacing \"machine\" with the network name of the machine running __barnacles-opcua__.  Optionally update the other fields of the distinguished name to reflect the organisation/software using __barnacles-opcua__.\n\n### Create a CA.cnf file\n\n```\n[ req ]\nprompt = no\ndistinguished_name = req_distinguished_name\n\n[ req_distinguished_name ]\nC = CA\nST = QC\nL = Montreal\nO = reelyActive\nOU = Develop\nCN = Pareto Anywhere\n```\n\nOptionally update the fields of the distinguished name to reflect the organisation/software using __barnacles-opcua__.\n\n### Create the .pem files using OpenSSL\n\nFirst, generate a CA private key \u0026 certificate:\n\n    openssl req -nodes -new -x509 -keyout CA_key.pem -out CA_certificate.pem -days 1825 -config CA.cnf\n\nSecond, generate the web server's secret key \u0026 CSR:\n\n    openssl req -sha256 -nodes -newkey rsa:2048 -keyout key.pem -out server.csr -config server.cnf\n\nThird, create the web server's certificate, signing it with its own certificate authority:\n\n    openssl x509 -req -days 398 -in server.csr -CA CA_certificate.pem -CAkey CA_key.pem -CAcreateserial -out certificate.pem -extensions req_ext -extfile server.cnf\n\n### Assign the certificates\n\nConfigure __barnacles-opcua__ by copying the `certificate.pem` and `key.pem` files to the /config folder, as described in the [Config Files](#standalone-secure-websockets) section above.\n\n\nOptions\n-------\n\n__barnacles-opcua__ supports the following options:\n\n| Property        | Default                    | Description                   | \n|:----------------|:---------------------------|:------------------------------|\n| port            | 4840                       | OPC UA Server port            |\n| certificateFile | config/certificate.pem     | Path to optional certificate  |\n| privateKeyFile  | config/key.pem             | Path to optional key          |\n\n\nAcknowledgements\n----------------\n\n__barnacles-opcua__ is based on the [Node-OPCUA](https://node-opcua.github.io/) open source project, maintained by [Sterfive](https://www.sterfive.com), which we invite you to consider sponsoring at [opencollective.com/node-opcua](https://opencollective.com/node-opcua).\n\n\nContributing\n------------\n\nDiscover [how to contribute](CONTRIBUTING.md) to this open source project which upholds a standard [code of conduct](CODE_OF_CONDUCT.md).\n\n\nSecurity\n--------\n\nConsult our [security policy](SECURITY.md) for best practices using this open source software and to report vulnerabilities.\n\n\nLicense\n-------\n\nMIT License\n\nCopyright (c) 2024-2025 [reelyActive](https://www.reelyactive.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN \nTHE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbarnacles-opcua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freelyactive%2Fbarnacles-opcua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbarnacles-opcua/lists"}