{"id":15320489,"url":"https://github.com/szuecs/esp32-dh22-metrics","last_synced_at":"2025-04-05T18:44:51.308Z","repository":{"id":66666932,"uuid":"231790995","full_name":"szuecs/esp32-dh22-metrics","owner":"szuecs","description":"Get data from dh22 running on esp32 and sends Prometheus metrics via pushgateway","archived":false,"fork":false,"pushed_at":"2020-01-04T20:25:11.000Z","size":32,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-11T16:18:59.136Z","etag":null,"topics":["dh22","esp32-arduino","iot","prometheus","pushgateway"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szuecs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-04T16:07:23.000Z","updated_at":"2022-01-28T01:21:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"7444bac2-8032-4e85-8462-18c1b709af35","html_url":"https://github.com/szuecs/esp32-dh22-metrics","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"b9c04758a2f10f87756e8a9a6fcf7bc961eca869"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szuecs%2Fesp32-dh22-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szuecs%2Fesp32-dh22-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szuecs%2Fesp32-dh22-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szuecs%2Fesp32-dh22-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szuecs","download_url":"https://codeload.github.com/szuecs/esp32-dh22-metrics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247385590,"owners_count":20930599,"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":["dh22","esp32-arduino","iot","prometheus","pushgateway"],"created_at":"2024-10-01T09:08:35.478Z","updated_at":"2025-04-05T18:44:51.285Z","avatar_url":"https://github.com/szuecs.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp32-dh22-metrics\nGet data from\n[AM2302](http://akizukidenshi.com/download/ds/aosong/AM2302.pdf)\n(dh22) running on an\n[esp32](https://www.espressif.com/en/products/hardware/esp32/overview)\nand sends [Prometheus](https://github.com/prometheus/prometheus)\nmetrics to a [pushgateway](https://github.com/prometheus/pushgateway)\nusing WiFi.\nPrometheus can scrape metrics from the pushgateway and you can use\n[grafana](https://github.com/grafana/grafana) to show nice dashboards.\n\n## Features\n\nYou can select different serial output and push data types. Both\nsupports CSV, JSON and Prometheus data.\nSerial output defaults to CSV and push data defaults to Prometheus.\n\nAll data and functions exported by https://github.com/beegee-tokyo/DHTesp\nlibrary are used to provide the metrics.\n\n## Requirements\n\nHardware:\n\n- dev board: ESP32\n- sensor: AM2302 (dh22)\n- USB connector to connect your computer with ESP32 (power and flash)\n- 3 cable connectors to connect sensor with ESP32 (power, ground, GPIO data), see also [page 2 picture and table top left](https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf)\n\nSoftware:\n\n- pushgateway should be running, for example: `docker run -d -hostnetwork -p 9091:9091 prom/pushgateway`\n- C++ dev package to have [unordered_map](https://en.cppreference.com/w/cpp/container/unordered_map), should be available.\n\nYou can find a nice tutorial at [techtutorialsx](https://techtutorialsx.com/2018/04/18/esp32-arduino-getting-temperature-from-a-dht22-sensor/).\n\n## Install\n\nInstall [Arduino IDE](https://www.arduino.cc/en/main/software) and start Arduino IDE.\n\nInstall dependencies:\n\n1. Install in the IDE: Board \"ESP32 Dev Module\" (`Tools -\u003e Manage Libraries..`)\n1. Install in the IDE: beegee-tokyo DHTesp https://github.com/beegee-tokyo/DHTesp (`Tools -\u003e Manage Libraries..`)\n\nFirst steps:\n\n1. If you have the hardware connected and all dependencies setup, clone this repository\n1. Open `File -\u003e Open...` dialog to open the cloned repository and select file `esp32-dh22-metrics.ino`\n1. Change file `esp32-dh22-metrics.ino` line 10-13 to your own setup\n1. click `Tools -\u003e Port` and select your USB serial port to configure the connection from your computer to ESP32.\n1. click the `Upload` button to flash your ESP32 and run the software\n1. Open the `Tools -\u003e Serial Monitor` to show the serial output of the software running on your ESP32, after a few seconds you should get some data output, if it was successful\n1. Check metrics endpoint of the running pushgateway\n\n```\n% curl -s http://127.0.0.1:9091/metrics | grep dh22\nabsolute_humidity{instance=\"dc\",job=\"dh22\"} 9\ncomfort_status{instance=\"dc\",job=\"dh22\",state=\"Comfort_OK\"} 1\ndew_point{instance=\"dc\",job=\"dh22\"} 9.9\ndistance_too_cold{instance=\"dc\",job=\"dh22\"} 1\ndistance_too_dry{instance=\"dc\",job=\"dh22\"} -1624.1\ndistance_too_hot{instance=\"dc\",job=\"dh22\"} -7.7\ndistance_too_humid{instance=\"dc\",job=\"dh22\"} -1079.4\nheat_index{instance=\"dc\",job=\"dh22\"} 19.7\nhumidity{instance=\"dc\",job=\"dh22\"} 51\npush_failure_time_seconds{instance=\"dc\",job=\"dh22\"} 0\npush_time_seconds{instance=\"dc\",job=\"dh22\"} 1.578165888371657e+09\ntemperature_celsius{instance=\"dc\",job=\"dh22\"} 20.3\ntoo_cold{instance=\"dc\",job=\"dh22\"} 1\ntoo_dry{instance=\"dc\",job=\"dh22\"} 0\ntoo_hot{instance=\"dc\",job=\"dh22\"} 0\ntoo_humid{instance=\"dc\",job=\"dh22\"} 0\n```\n\n## Development\n\nPlease create issues and Pull requests as you like.\n\n## License\n\n[LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszuecs%2Fesp32-dh22-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszuecs%2Fesp32-dh22-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszuecs%2Fesp32-dh22-metrics/lists"}