{"id":17855588,"url":"https://github.com/nebrius/raspi-onewire","last_synced_at":"2026-04-30T10:35:04.305Z","repository":{"id":65482503,"uuid":"103560351","full_name":"nebrius/raspi-onewire","owner":"nebrius","description":"Provides access to 1-Wire on the Raspberry Pi from Node.js","archived":false,"fork":false,"pushed_at":"2018-01-17T01:32:09.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T13:39:15.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/nebrius.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-14T17:14:47.000Z","updated_at":"2020-10-25T18:55:17.000Z","dependencies_parsed_at":"2023-01-25T10:45:27.538Z","dependency_job_id":null,"html_url":"https://github.com/nebrius/raspi-onewire","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Fraspi-onewire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Fraspi-onewire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Fraspi-onewire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Fraspi-onewire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nebrius","download_url":"https://codeload.github.com/nebrius/raspi-onewire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246866099,"owners_count":20846496,"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":[],"created_at":"2024-10-28T02:23:41.714Z","updated_at":"2026-04-30T10:35:04.261Z","avatar_url":"https://github.com/nebrius.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Raspi OneWire\n=============\n\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nebrius/raspi-io?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nRaspi OneWire is part of the [Raspi.js suite of libraries](https://github.com/nebrius/raspi) that provides access to a software emulated 1-wire interface on a Raspberry Pi.\n\nIf you have a bug report, feature request, or wish to contribute code, please be sure to check out the [Raspi IO Contributing Guide](https://github.com/nebrius/raspi-io/blob/master/CONTRIBUTING.md).\n\n## System Requirements\n\n- Raspberry Pi Model B Rev 1 or newer (sorry Model A users)\n- Raspbian Jessie or newer\n  - [Node-RED](http://nodered.org/) works, but can be finicky and difficult to debug.\n  - See https://github.com/nebrius/raspi-io/issues/24 for more info about support for other OSes\n- Node 4.0.0 or newer\n\nDetailed instructions for getting a Raspberry Pi ready for NodeBots, including how to install Node.js, can be found in the [wiki](https://github.com/nebrius/raspi-io/wiki/Getting-a-Raspberry-Pi-ready-for-NodeBots)\n\n## Installation\n\nFirst, be sure that you have installed [Raspi.js](https://github.com/nebrius/raspi).\n\nInstall with npm:\n\n```Shell\nnpm install raspi-onewire\n```\n\n**Note:** this project is written in [TypeScript](http://www.typescriptlang.org/) and includes type definitions in the package.json file. This means that if you want to use it from TypeScript, you don't need to install a separate @types module.\n\n## Example Usage\n\nIn TypeScript/ES2015+:\n\n```JavaScript\nimport { init } from 'raspi';\nimport { OneWire } from 'raspi-onewire';\n\ninit(() =\u003e {\n  const bus = new OneWire();\n  bus.searchForDevices((err, devices) =\u003e {\n    bus.readAllAvailable(devices[0], (err, data) =\u003e {\n      console.log(data);\n    });\n  });\n});\n```\n\nIn JavaScript/ES5:\n\n```JavaScript\nconst raspi = require('raspi');\nconst OneWire = require('raspi-onewire').OneWire;\n\nraspi.init(() =\u003e {\n  const bus = new OneWire();\n  bus.searchForDevices((err, devices) =\u003e {\n    bus.readAllAvailable(devices[0], (err, data) =\u003e {\n      console.log(data);\n    });\n  });\n});\n```\n\n## API\n\n### new OneWire()\n\nInstantiates a new OneWire instance. Note that OneWire only works on pin `GPIO4`.\n\n_Arguments_: None\n\n### Instance Methods\n\n#### searchForDevices(cb)\n\nSearches for all devices currently attached to the bus.\n\n_Arguments_:\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eArgument\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ecb\u003c/td\u003e\n    \u003ctd\u003eFunction\u003c/td\u003e\n    \u003ctd\u003eThe callback to call with the results.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003c/td\u003e\n    \u003ctd colspan=\"2\"\u003e\n      \u003ctable\u003e\n        \u003cthead\u003e\n          \u003ctr\u003e\n            \u003cth\u003eArgument\u003c/th\u003e\n            \u003cth\u003eType\u003c/th\u003e\n            \u003cth\u003eDescription\u003c/th\u003e\n          \u003c/tr\u003e\n        \u003c/thead\u003e\n        \u003ctr\u003e\n          \u003ctd\u003eerr\u003c/td\u003e\n          \u003ctd\u003eString | Error | undefined\u003c/td\u003e\n          \u003ctd\u003eThe error, if one occurred, else undefined\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n          \u003ctd\u003edevices\u003c/td\u003e\n          \u003ctd\u003eundefined | Number[][]\u003c/td\u003e\n          \u003ctd\u003eIf no error occurred, an array of zero or more device IDs\u003c/td\u003e\n        \u003c/tr\u003e\n      \u003c/table\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n_Returns_: None\n\n#### read(deviceID, numBytesToRead, cb)\n\nReads the specified number of bytes from the device specified.\n\n_Arguments_:\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eArgument\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctr\u003e\n    \u003ctd\u003edeviceID\u003c/td\u003e\n    \u003ctd\u003eNumber[]\u003c/td\u003e\n    \u003ctd\u003eThe ID of the device, as returned from \u003ccode\u003esearchForDevices\u003c/code\u003e.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003enumBytesToRead\u003c/td\u003e\n    \u003ctd\u003eNumber\u003c/td\u003e\n    \u003ctd\u003eThe number of bytes to read.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ecb\u003c/td\u003e\n    \u003ctd\u003eFunction\u003c/td\u003e\n    \u003ctd\u003eThe callback to call with the read data.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003c/td\u003e\n    \u003ctd colspan=\"2\"\u003e\n      \u003ctable\u003e\n        \u003cthead\u003e\n          \u003ctr\u003e\n            \u003cth\u003eArgument\u003c/th\u003e\n            \u003cth\u003eType\u003c/th\u003e\n            \u003cth\u003eDescription\u003c/th\u003e\n          \u003c/tr\u003e\n        \u003c/thead\u003e\n        \u003ctr\u003e\n          \u003ctd\u003eerr\u003c/td\u003e\n          \u003ctd\u003eString | Error | undefined\u003c/td\u003e\n          \u003ctd\u003eThe error, if one occurred, else undefined\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n          \u003ctd\u003edata\u003c/td\u003e\n          \u003ctd\u003eundefined | Buffer\u003c/td\u003e\n          \u003ctd\u003eIf no error occurred, the read data. The number of bytes read may be less than \u003ccode\u003enumBytesToRead\u003c/code\u003e if there are not that many bytes to read at the time of the call.\u003c/td\u003e\n        \u003c/tr\u003e\n      \u003c/table\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n_Returns_: None\n\n#### readAllAvailable(deviceID, cb)\n\nReads all available bytes from the device specified.\n\n_Arguments_:\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eArgument\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctr\u003e\n    \u003ctd\u003edeviceID\u003c/td\u003e\n    \u003ctd\u003eNumber[]\u003c/td\u003e\n    \u003ctd\u003eThe ID of the device, as returned from \u003ccode\u003esearchForDevices\u003c/code\u003e.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ecb\u003c/td\u003e\n    \u003ctd\u003eFunction\u003c/td\u003e\n    \u003ctd\u003eThe callback to call with the read data.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003c/td\u003e\n    \u003ctd colspan=\"2\"\u003e\n      \u003ctable\u003e\n        \u003cthead\u003e\n          \u003ctr\u003e\n            \u003cth\u003eArgument\u003c/th\u003e\n            \u003cth\u003eType\u003c/th\u003e\n            \u003cth\u003eDescription\u003c/th\u003e\n          \u003c/tr\u003e\n        \u003c/thead\u003e\n        \u003ctr\u003e\n          \u003ctd\u003eerr\u003c/td\u003e\n          \u003ctd\u003eString | Error | undefined\u003c/td\u003e\n          \u003ctd\u003eThe error, if one occurred, else undefined\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n          \u003ctd\u003edata\u003c/td\u003e\n          \u003ctd\u003eundefined | Buffer\u003c/td\u003e\n          \u003ctd\u003eIf no error occurred, the read data.\u003c/td\u003e\n        \u003c/tr\u003e\n      \u003c/table\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n_Returns_: None\n\nLicense\n=======\n\nThe MIT License (MIT)\n\nCopyright (c) 2014-2017 Bryan Hughes \u003cbryan@nebri.us\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebrius%2Fraspi-onewire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnebrius%2Fraspi-onewire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebrius%2Fraspi-onewire/lists"}