{"id":22398534,"url":"https://github.com/ianmetcalf/node-ds2482-temperature","last_synced_at":"2025-07-31T13:31:54.566Z","repository":{"id":25151769,"uuid":"28574297","full_name":"ianmetcalf/node-ds2482-temperature","owner":"ianmetcalf","description":"Provides an interface for Dallas DS18B20 temperature sensors over the DS2482 onewire bridge","archived":false,"fork":false,"pushed_at":"2017-04-21T03:07:56.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-13T09:48:01.711Z","etag":null,"topics":["beaglebone-black","ds18b20","ds2482","onewire","raspberry-pi","temperature-sensor"],"latest_commit_sha":null,"homepage":"","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/ianmetcalf.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-12-28T23:41:01.000Z","updated_at":"2023-07-17T01:09:31.000Z","dependencies_parsed_at":"2022-08-28T21:01:10.557Z","dependency_job_id":null,"html_url":"https://github.com/ianmetcalf/node-ds2482-temperature","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianmetcalf%2Fnode-ds2482-temperature","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianmetcalf%2Fnode-ds2482-temperature/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianmetcalf%2Fnode-ds2482-temperature/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ianmetcalf%2Fnode-ds2482-temperature/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ianmetcalf","download_url":"https://codeload.github.com/ianmetcalf/node-ds2482-temperature/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228249364,"owners_count":17891461,"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":["beaglebone-black","ds18b20","ds2482","onewire","raspberry-pi","temperature-sensor"],"created_at":"2024-12-05T07:11:17.043Z","updated_at":"2024-12-05T07:11:17.793Z","avatar_url":"https://github.com/ianmetcalf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DS18B20 Onewire Temperature Sensor\n\n[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/ianmetcalf/node-ds2482?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nProvides an interface for Dallas DS18B20 temperature sensors over the DS2482 onewire bridge\n\n# Install\n\n```\n$ npm install ds2482-temperature\n```\n\n# Usage\n\n```js\nconst DS18B20 = require('ds2482-temperature');\n\nconst sense = new DS18B20();\n\nsense.init()\n.then(() =\u003e sense.search())\n.then(() =\u003e sense.readTemperatures())\n\n.then(temps =\u003e {\n  console.log(temps); // Returns a list of temperature reading from all found sensors\n})\n\n.catch(err =\u003e {\n  console.error(err);\n});\n```\n\n## Streaming\n\n```js\nconst DS18B20 = require('ds2482-temperature');\n\nconst sense = new DS18B20();\n\nsense.init()\n\n.then(() =\u003e {\n  sense.on('data', val =\u003e {\n    console.log(val);\n  });\n\n  sense.on('error', err =\u003e {\n    console.error(err);\n  });\n});\n```\n\n# API\n\n### new DS18B20([options])\n\nCreates an interface for Dallas DS18B20 temperature sensors. The instance inherites from\n[readable stream](https://nodejs.org/api/stream.html#stream_readable_streams)\nand will search and emit measurements for all found sensors when a `data` listener is added.\n\n__Options:__\n- `wire` an instance of [wire](https://github.com/ianmetcalf/node-ds2482)\n- `i2c` an instance of [i2c](https://github.com/kelly/node-i2c)\n- `address` the i2c address of the bridge chip, default: `0x18`\n- `device` the location of the i2c interface, default: `/dev/i2c-1`\n- `units` the temperature units, default: `C`\n- `pollRate` the rate to poll the sensors when streaming, default: `30 secs`\n\n---\n\n### sense.init()\nResets the bridge chip and any onewire devices connected to it\n\n__Returns:__ `Promise \u003cUint8\u003e` resolves with DS2482 status register\n\n---\n\n### sense.search()\nSearches the bus and returns a list of found temperature sensors\n\n__Returns:__ `Promise \u003cArray \u003cSensor\u003e\u003e` resolves with list of sensors\n\n```js\n[\n  \u003cSensor \"2826274402000012\"\u003e,\n  \u003cSensor \"28493331020000bf\"\u003e,\n  \u003cSensor \"280b135f020000d9\"\u003e\n]\n```\n\n---\n\n### sense.readTemperatures()\nInitiates a measurement and returns the temperature readings from all known sensors\n\n__Returns:__ `Promise \u003cArray {rom:String, value:Number, units:Sting}\u003e` resolves with list of temperatures\n\n```js\n[\n  {rom: \"2826274402000012\", value: 22.9375, units: \"C\"},\n  {rom: \"28493331020000bf\", value: 22.875, units: \"C\"},\n  {rom: \"280b135f020000d9\", value: 21.9375, units: \"C\"},\n]\n```\n\n---\n\n### sense.destroy()\nDestroys the streaming interface\n\n---\n\n### new DS18B20.Sensor(rom [, options])\n\nCreates a temperature sensor instance. The instance inherites from\n[readable stream](https://nodejs.org/api/stream.html#stream_readable_streams)\nand will emit measurements from the sensor when a `data` listener is added.\n\n__Arguments:__\n- `rom` the ROM address of the sensor as a 16 character hex encoded string\n\n__Options:__\n- `wire` an instance of [wire](https://github.com/ianmetcalf/node-ds2482)\n- `i2c` an instance of [i2c](https://github.com/kelly/node-i2c)\n- `address` the i2c address of the bridge chip, default: `0x18`\n- `device` the location of the i2c interface, default: `/dev/i2c-1`\n- `units` the temperature units, default: `C`\n- `pollRate` the rate to poll the sensor when streaming, default: `30 secs`\n\n---\n\n### sensor.readTemperature()\nInitiates a measurement and returns the temperature reading from a particular sensor\n\n__Returns:__ `Promise \u003cNumber\u003e` resolves with temperature\n\n```js\n22.9375\n```\n\n---\n\n### sensor.destroy()\nDestroys the streaming interface\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianmetcalf%2Fnode-ds2482-temperature","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fianmetcalf%2Fnode-ds2482-temperature","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fianmetcalf%2Fnode-ds2482-temperature/lists"}