{"id":22859978,"url":"https://github.com/reelyactive/barnacles","last_synced_at":"2025-08-11T09:31:44.014Z","repository":{"id":22808065,"uuid":"26154737","full_name":"reelyactive/barnacles","owner":"reelyactive","description":"Efficient real-time processor of ambient IoT data, enabling hyperlocal context as standard JSON.  We believe in an open Internet of Things.","archived":false,"fork":false,"pushed_at":"2024-10-15T19:53:43.000Z","size":607,"stargazers_count":5,"open_issues_count":2,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-15T04:08:58.595Z","etag":null,"topics":["context-awareness","dynamb","iot","node-js","pareto-anywhere","raddec","rtls","socket-io"],"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":"2014-11-04T05:42:57.000Z","updated_at":"2024-10-15T19:53:47.000Z","dependencies_parsed_at":"2022-07-27T03:32:21.049Z","dependency_job_id":"77af3efa-4ff8-43c4-b226-4e6e34bfb3ce","html_url":"https://github.com/reelyactive/barnacles","commit_stats":{"total_commits":304,"total_committers":1,"mean_commits":304.0,"dds":0.0,"last_synced_commit":"f36804d36c0f254ddd75ee1ff281bf25ff7aafd0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnacles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reelyactive","download_url":"https://codeload.github.com/reelyactive/barnacles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229517375,"owners_count":18085490,"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":["context-awareness","dynamb","iot","node-js","pareto-anywhere","raddec","rtls","socket-io"],"created_at":"2024-12-13T09:08:35.399Z","updated_at":"2025-08-11T09:31:44.002Z","avatar_url":"https://github.com/reelyactive.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"barnacles\n=========\n\n__barnacles__ processes a real-time stream of ambient RF decodings into an efficient representation of \"_what_ is _where_ and _how_\" as standard developer-friendly JSON that is vendor/technology/application-agnostic.\n\n![Overview of barnacles](https://reelyactive.github.io/barnacles/images/overview.png)\n\n__barnacles__ ingests and outputs a real-time stream of [raddec](https://github.com/reelyactive/raddec/) objects, and can be coupled with [advlib](https://github.com/reelyactive/advlib/) packet processors to additionally interpret _dynamb_ (dynamic ambient), _statid_ (static ID) and _relay_ data for each device.\n\n__barnacles__ is a lightweight [Node.js package](https://www.npmjs.com/package/barnacles) that can run on resource-constrained edge devices as well as on powerful cloud servers and anything in between.  It is included in reelyActive's [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source IoT middleware suite where it maintains an in-memory snapshot of the [hyperlocal context](https://www.reelyactive.com/context/) data structure for consumption by API modules, and distribution by [barnacles-x modules](#how-to-distribute-data).\n\n\nGetting Started\n---------------\n\nFollow our step-by-step tutorials to get started with __Pareto Anywhere__, which includes __barnacles__, on the platform of your choice:\n- [Run Pareto Anywhere on a personal computer](https://reelyactive.github.io/diy/pareto-anywhere-pc/)\n- [Run Pareto Anywhere on a Raspberry Pi](https://reelyactive.github.io/diy/pareto-anywhere-pi/)\n\nLearn \"owl\" about the __raddec__ and __dynamb__ JSON data output:\n-  [reelyActive Developer's Cheatsheet](https://reelyactive.github.io/diy/cheatsheet/)\n\n\nQuick start\n-----------\n\nClone this repository, install package dependencies with `npm install`, and then from the root folder run at any time:\n\n    npm start\n\n__barnacles__ will listen for raddec UDP packets on port 50001 and print the aggregated raddec output to the console.\n\n\nHello barnacles \u0026 barnowl\n-------------------------\n\n```javascript\nconst Barnowl = require('barnowl');\nconst Barnacles = require('barnacles');\n\nlet barnowl = new Barnowl();\nbarnowl.addListener(Barnowl, {}, Barnowl.TestListener, {}); // Source of data\n\nlet barnacles = new Barnacles({ barnowl: barnowl });\nbarnacles.on('raddec', (raddec) =\u003e {\n  console.log(raddec);\n});\n```\n\nAs output you should see a stream of [raddec](https://github.com/reelyactive/raddec/) objects similar to the following:\n\n```javascript\n{\n  transmitterId: \"001122334455\",\n  transmitterIdType: 2,\n  rssiSignature:\n   [ { receiverId: \"001bc50940810000\",\n       receiverIdType: 1,\n       numberOfDecodings: 1,\n       rssi: -60 },\n     { receiverId: \"001bc50940810001\",\n       receiverIdType: 1,\n       numberOfDecodings: 1,\n       rssi: -66 } ],\n  packets: [ \"061b55443322110002010611074449555520657669746341796c656572\" ],\n  timestamp: 1547693457133,\n  events: [ 0 ]\n}\n```\n\nRegardless of the underlying RF protocol and hardware, the [raddec](https://github.com/reelyactive/raddec/) specifies _what_ (transmitterId) is _where_ (receiverId \u0026 rssi), as well as _how_ (packets) and _when_ (timestamp).  __barnacles__ adds an _events_ property which indicates what has notably changed in the most recent radio decoding(s).\n\n\nC'est-tu tout que ta barnacles peut faire?\n------------------------------------------\n\nThe silly Québécois title aside (we couldn't resist the temptation), although __barnacles__ and __barnowl__ together may suffice for simple event-driven applications, functionality can be greatly extended with the following software packages:\n- [advlib](https://github.com/reelyactive/advlib) to decode the individual packets from hexadecimal strings into JSON\n- [chickadee](https://github.com/reelyactive/chickadee) to provide a /context API by associating structured, linked data with the devices identified in the radio decodings\n- [barterer](https://github.com/reelyactive/barterer) to provide a /devices API\n\n\nHow to decode packets?\n----------------------\n\n__barnacles__ can accept packet processors, libraries and interpreters to decode raw packet data and trigger events in consequence.  For instance, instantiate __barnacles__ with all of the __advlib__ modules as follows:\n\n```javascript\nlet options = {\n    packetProcessors: [ { processor: require('advlib-ble'),\n                          libraries: [ require('advlib-ble-services'),\n                                       require('advlib-ble-manufacturers') ],\n                          options: { ignoreProtocolOverhead: true,\n                                     indices: [ require('sniffypedia') ] } } ],\n    packetInterpreters: [ require('advlib-interoperable') ]\n};\n\nlet barnacles = new Barnacles(options);\n```\n\nPacket decoding is a prerequisite for _dynamb_ and _relay_ events and _statid_ data, with the exception of Electronic Product Code (EPC) data which is automatically decoded as _statid_ data by __barnacles__ using [advlib-epc](https://github.com/reelyactive/advlib-epc).\n\n\nHow to distribute data?\n-----------------------\n\n__barnacles__ is an EventEmitter which means that software can listen for _raddec_, _dynamb_ and _relay_ events.  To facilitate distribution over a network, __barnacles__ interfaces with a number of complementary software packages to keep the code as lightweight and modular as possible.  The following table lists all these interface packages which integrate seamlessly with __barnacles__ in just two lines of code.\n\n| Interface package                                                | Provides |\n|:-----------------------------------------------------------------|:---------|\n| [barnacles-webhook](https://github.com/reelyactive/barnacles-webhook) | Webhook (event-driven HTTP POST) |\n| [barnacles-websocket](https://github.com/reelyactive/barnacles-websocket) | WebSocket server |\n| [barnacles-socketio](https://github.com/reelyactive/barnacles-socketio) | socket.io push API |\n| [barnacles-mqtt](https://github.com/reelyactive/barnacles-mqtt) | MQTT |\n| [barnacles-sparkplug](https://github.com/reelyactive/barnacles-sparkplug) | Sparkplug (MQTT) |\n| [barnacles-opcua](https://github.com/reelyactive/barnacles-opcua) | OPC-UA |\n| [barnacles-logfile](https://github.com/reelyactive/barnacles-logfile) | Write raddec \u0026 dynamb events to a local logfile |\n| [barnacles-postgres](https://github.com/reelyactive/barnacles-postgres) | PostgreSQL database interface |\n| [barnacles-influxdb2](https://github.com/reelyactive/barnacles-influxdb2) | InfluxDB 2 database interface |\n| [barnacles-elasticsearch](https://github.com/reelyactive/barnacles-elasticsearch) | Elasticsearch database interface |\n| [barnacles-tds](https://github.com/reelyactive/barnacles-tds) | SQL Server (Tabular Data Stream) |\n| [barnacles-agora](https://github.com/reelyactive/barnacles-agora) | Agora Software interface |\n| [barnacles-wiliot](https://github.com/reelyactive/barnacles-wiliot) | Relay IoT Pixel payloads to the Wiliot Cloud |\n\nSee our [Create a Pareto Anywhere startup script](https://reelyactive.github.io/diy/pareto-anywhere-startup-script/) tutorial for detailed instructions on including any of the above interface packages with a [pareto-anywhere](https://github.com/reelyactive/pareto-anywhere) deployment, or consult the examples below for a standalone __barnacles__ deployment.\n\n### Example: socket.io push API\n\n```javascript\nconst Barnowl = require('barnowl');\nconst Barnacles = require('barnacles');\nconst BarnaclesSocketIO = require('barnacles-socketio'); // 1: Include the package\n\nlet barnowl = new Barnowl();\nlet barnacles = new Barnacles({ barnowl: barnowl });\nbarnowl.addListener(Barnowl, {}, Barnowl.TestListener, {});\n\n// 2: Add the interface with relevant options\nbarnacles.addInterface(BarnaclesSocketIO, {});\n```\n\n### Example: Webhook\n\n```javascript\nconst Barnowl = require('barnowl');\nconst Barnacles = require('barnacles');\nconst BarnaclesWebhook = require('barnacles-webhook'); // 1: Include the package\n\nlet barnowl = new Barnowl();\nlet barnacles = new Barnacles({ barnowl: barnowl });\nbarnowl.addListener(Barnowl, {}, Barnowl.TestListener, {});\n\n// 2: Add the interface with relevant options\nbarnacles.addInterface(BarnaclesWebhook, { hostname: \"127.0.0.1\", port: 3000 });\n```\n\n### Example: Elasticsearch\n\n```javascript\nconst Barnowl = require('barnowl');\nconst Barnacles = require('barnacles');\nconst BarnaclesElasticsearch = require('barnacles-elasticsearch'); // 1\n\nlet barnowl = new Barnowl();\nlet barnacles = new Barnacles({ barnowl: barnowl });\nbarnowl.addListener(Barnowl, {}, Barnowl.TestListener, {});\n\n// 2: Add the interface with relevant options\nbarnacles.addInterface(BarnaclesElasticsearch, { host: \"127.0.0.1:9200\" });\n```\n\n\nOptions\n-------\n\n__barnacles__ supports the following options:\n\n| Property               | Default | Description                            | \n|:-----------------------|:--------|:---------------------------------------|\n| delayMilliseconds      | 1000    | How long to wait for data to arrive from all possible sources before determining if an event occurred (introduces the given amount of latency) |\n| minDelayMilliseconds   | 100     | Minimum time to wait between subsequent batches of event computation (gives the CPU a break) |\n| decodingCompilationMilliseconds  | 2000 | On an event, combine rssiSignatures from raddecs up to this far in the past |\n| packetCompilationMilliseconds    | 5000 | On an event, combine packets from raddecs up to this far in the past |\n| historyMilliseconds    | 8000    | How long to consider historic spatio-temporal data before it is flushed from memory (if historyMilliseconds is less than keepAliveMilliseconds data may be lost) |\n| keepAliveMilliseconds  | 5000    | How long to wait before triggering a keep-alive event in the absence of other events for a given transmitter. |\n| disappearanceMilliseconds        | 15000 | How long to wait before a device is considered to have disappeared (and also how long to retain dynamb data). |\n| observedEvents         | [ 0, 1, 2, 3 ] | Index list of the event types to emit |\n| acceptStaleRaddecs     | false   | Accept raddecs with a timestamp more than historyMilliseconds in the past? (timestamp gets adjusted to current time) |\n| acceptFutureRaddecs    | true    | Accept raddecs with a timestamp in the future? (timestamp gets adjusted to current time) |\n| barnowl                | null    | barnowl instance providing source data |\n| inputFilterParameters  | {}      | Filter on inbound raddecs (see [raddec-filter](https://github.com/reelyactive/raddec-filter)) |\n| outputFilterParameters | {}      | Filter on outbound raddecs (see [raddec-filter](https://github.com/reelyactive/raddec-filter)) |\n| packetProcessors       | []      | Processors for packet data (see [advlib](https://github.com/reelyactive/advlib)) |\n| packetInterpreters     | []    | Interpreters for packet data (see [advlib](https://github.com/reelyactive/advlib)) |\n| protocolSpecificDataProcessors | [] | Processors for protocol-specific data (see [advlib](https://github.com/reelyactive/advlib)) |\n| dynambProperties       | { ... } | Packet properties to include in dynamb events |\n| statidProperties       | { ... } | Packet properties to include as statid |\n\n\n![barnacles logo](https://reelyactive.github.io/barnacles/images/barnacles-bubble.png)\n\n\nWhat's in a name?\n-----------------\n\nAs [Wikipedia so eloquently states](http://en.wikipedia.org/wiki/Barnacle#Sexual_reproduction), \"To facilitate genetic transfer between isolated individuals, __barnacles__ have extraordinarily long penises.\"  And given the current state of isolation of nodes in today's IoT, this package (pun intended) needs \"the largest penis to body size ratio of the animal kingdom\".\n\nAlso, we hope the name provides occasions to overhear our Québécois colleagues say things like _\"Tu veux tu configurer ta barnacle!?!\"_\n\n\nProject History\n---------------\n\n__barnacles__ v1.0.0 was released in January 2019, superseding all earlier versions, the latest of which remains available in the [release-0.4 branch](https://github.com/reelyactive/barnacles/tree/release-0.4) and as [barnacles@0.4.12 on npm](https://www.npmjs.com/package/barnacles/v/0.4.12).\n\n\nModular Architecture\n--------------------\n\n__barnacles__ is easily combined with the following complementary software modules:\n- [barnowl](https://github.com/reelyactive/barnowl)\n- [barterer](https://github.com/reelyactive/barterer)\n- [chickadee](https://github.com/reelyactive/chickadee)\n- [chimps](https://github.com/reelyactive/chimps)\n- [advlib](https://github.com/reelyactive/advlib)\n\nLearn more about the [reelyActive Open Source Software packages](https://reelyactive.github.io/diy/oss-packages/), all of which are bundled together as [Pareto Anywhere](https://github.com/reelyactive/pareto-anywhere) open source IoT middleware.\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) 2014-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.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbarnacles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freelyactive%2Fbarnacles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbarnacles/lists"}