{"id":20081259,"url":"https://github.com/depuits/pigpio-dht","last_synced_at":"2025-05-06T00:31:09.461Z","repository":{"id":57324119,"uuid":"122611282","full_name":"depuits/pigpio-dht","owner":"depuits","description":"DHT implementation using node.js and pigpio.","archived":false,"fork":false,"pushed_at":"2019-07-26T13:12:17.000Z","size":16,"stargazers_count":15,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T21:31:51.692Z","etag":null,"topics":["dht","pigpio","pigpio-dht","sensor"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/depuits.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":"2018-02-23T11:10:07.000Z","updated_at":"2024-02-29T04:56:08.000Z","dependencies_parsed_at":"2022-09-18T22:40:31.246Z","dependency_job_id":null,"html_url":"https://github.com/depuits/pigpio-dht","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depuits%2Fpigpio-dht","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depuits%2Fpigpio-dht/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depuits%2Fpigpio-dht/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depuits%2Fpigpio-dht/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/depuits","download_url":"https://codeload.github.com/depuits/pigpio-dht/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252598249,"owners_count":21774225,"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":["dht","pigpio","pigpio-dht","sensor"],"created_at":"2024-11-13T15:34:06.072Z","updated_at":"2025-05-06T00:31:09.150Z","avatar_url":"https://github.com/depuits.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pigpio-dht\n\nDht sensor control using node.js and pigpio. Supported sensors are DHT11, DHT22 and AM2302.\n\n## Installation\n\n1. Install [pigpio C library](https://github.com/joan2937/pigpio).\n2. Install module: `npm i pigpio-dht`.\n\n## Usage\n\n```javascript\nconst dht = require('pigpio-dht');\nconst sensor = dht(dataPin, dhtType);\n```\n\n| Sensor          | dhtType |\n|-----------------|:----------------:|\n| DHT11           | 11               |\n| DHT22 or AM2302 | 22               |\n\n### Example\n\n```javascript\nconst dht = require('pigpio-dht');\n\nconst dataPin = 5;\nconst dhtType = 22; //optional\nconst sensor = dht(dataPin, dhtType);\n\nsetInterval(() =\u003e { \n\tsensor.read();\n}, 2500); // the sensor can only be red every 2 seconds\n\nsensor.on('result', data =\u003e {\n\tconsole.log(`temp: ${data.temperature}°c`); \n\tconsole.log(`rhum: ${data.humidity}%`); \n});\n\nsensor.on('badChecksum', () =\u003e {\n\tconsole.log('checksum failed');\n});\n```\n\n### Methods\n#### `read()`\n\nStart a new reading of the sensor. This can't be called more then once every second for the DHT11 sensor or once every 2 seconds for the DHT22 sensor. \n\n### Events\n\n#### `start`\n\nEmitted when starting to read a value.\n\n#### `end`\n\nEmitted when the reading stops. This because it was complete, an error occurred or anything else.\n\n#### `result`\n\n- result object containing temperature and humidity\n\nEmitted when the reading was completed successful.\n\n#### `badChecksum`\n\nEmitted when finished reading but the checksum was invalid.\n\n## Built With\n\n* [pigpio](https://github.com/fivdi/pigpio) - Gpio wrapper for nodejs\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/depuits/pigpio-dht/tags).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepuits%2Fpigpio-dht","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepuits%2Fpigpio-dht","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepuits%2Fpigpio-dht/lists"}