{"id":20594950,"url":"https://github.com/hackuarium/legoino-mqtt-bridge","last_synced_at":"2025-07-31T02:08:39.563Z","repository":{"id":84232742,"uuid":"265245902","full_name":"Hackuarium/legoino-mqtt-bridge","owner":"Hackuarium","description":"Retrieve data from serial devices and publish it as MQTT messages","archived":false,"fork":false,"pushed_at":"2020-06-18T12:01:10.000Z","size":1231,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-11T19:50:35.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hackuarium.github.io/serial-mqtt-brigde/","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/Hackuarium.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-19T12:49:33.000Z","updated_at":"2020-06-18T12:01:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3505cc4-bae8-45f3-9d30-0aa0d4578eed","html_url":"https://github.com/Hackuarium/legoino-mqtt-bridge","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Hackuarium/legoino-mqtt-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hackuarium%2Flegoino-mqtt-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hackuarium%2Flegoino-mqtt-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hackuarium%2Flegoino-mqtt-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hackuarium%2Flegoino-mqtt-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hackuarium","download_url":"https://codeload.github.com/Hackuarium/legoino-mqtt-bridge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hackuarium%2Flegoino-mqtt-bridge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267976419,"owners_count":24174939,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-16T08:10:57.281Z","updated_at":"2025-07-31T02:08:39.501Z","avatar_url":"https://github.com/Hackuarium.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# legoino-mqtt-bridge\n\n[![NPM version][npm-image]][npm-url]\n[![build status][ci-image]][ci-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\nRetrieve data from serial devices when queried, and publish it as MQTT messages.\n\n## Installation\n\n`$ npm i legoino-mqtt-bridge`\n\n## Usage from CLI\n\n### Clone the project\n\n```bash\ngit clone https://github.com/Hackuarium/legoino-mqtt-bridge.git\n```\n\n### Run the project\n\nRun normally:\n\n```bash\nnpm start [options]\n```\n\nRun in debug mode:\n\n```bash\nnpm run start-dev [options]\n```\n\n### Options\n\nThe `index.js` script accepts four command line options:\n\n- `-t`: device type (default 'bioreactor')\n- `-b`: broker address (default 'mqtt://127.0.0.1:1883')\n- `-u`: username\n- `-p`: password\n\n## Usage from Node\n\n```js\nimport serialMqttBridge from 'legoino-mqtt-bridge';\n\nserialMqttBridge({broker: 'mqtt://192.168.1.2:1883', type: 'bioreactor', username: 'brokerUsername', password: 'brokerPassword');\n```\n\n## MQTT topics standard\n\nWe define an MQTT topics standard: each topic sent to the bridge is composed of the device type (typically \"bioreactor\"), followed by a \"q\" (query) or \"a\" (answer), followed by the device unique id and finally the command asked for. The packages that will be sent to the bridge do not need to have any content (aka: they can be an empty string). Reading the MQTT doc confirmed that the message contents are indeed optional for publish messages.\n\n### Send a command to a serial device\n\nThe query topics format:\n\n```bash\n\u003ctype\u003e/q/\u003cid\u003e/\u003ccmd\u003e\n```\n\n### Query for all connected serial devices\n\nUse the following topic to get a list of all existing serial devices:\n\n```bash\n\u003ctype\u003e/q/list\n```\n\n### Answer topics\n\nTo listen to all the answers of the bridge, subscribe to this topic:\n\n```\n\u003ctype\u003e/a/#\n```\n\n## Test that the bridge answers correctly\n\nBe sure that you have previously installed mosquitto.\n\nCreate MQTT subscriber:\n\n```bash\nmosquitto_sub -t 'bioreactor/a/#'\n```\n\nPublish a message:\n\n```bash\nmosquitto_pub -t 'bioreactor/q/list' -m ''\n```\n\n## [API Documentation](https://hackuarium.github.io/legoino-mqtt-bridge/)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/legoino-mqtt-bridge.svg\n[npm-url]: https://www.npmjs.com/package/legoino-mqtt-bridge\n[ci-image]: https://github.com/cheminfo/legoino-mqtt-bridge/workflows/Node.js%20CI/badge.svg?branch=master\n[ci-url]: https://github.com/cheminfo/legoino-mqtt-bridge/actions?query=workflow%3A%22Node.js+CI%22\n[codecov-image]: https://img.shields.io/codecov/c/github/cheminfo/legoino-mqtt-bridge.svg\n[codecov-url]: https://codecov.io/gh/cheminfo/legoino-mqtt-bridge\n[download-image]: https://img.shields.io/npm/dm/legoino-mqtt-bridge.svg\n[download-url]: https://www.npmjs.com/package/legoino-mqtt-bridge\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackuarium%2Flegoino-mqtt-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackuarium%2Flegoino-mqtt-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackuarium%2Flegoino-mqtt-bridge/lists"}