{"id":28939219,"url":"https://github.com/jerr0328/co2mini","last_synced_at":"2025-07-07T19:09:46.602Z","repository":{"id":41890662,"uuid":"226693974","full_name":"jerr0328/co2mini","owner":"jerr0328","description":"Get your CO2 Monitor into Prometheus and HomeKit","archived":false,"fork":false,"pushed_at":"2024-03-01T01:04:08.000Z","size":37,"stargazers_count":10,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-21T16:17:40.776Z","etag":null,"topics":["co2-monitor","co2-sensor","co2monitor","hacktoberfest","homekit","prometheus","python3","raspberry-pi"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/co2mini/","language":"Python","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/jerr0328.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}},"created_at":"2019-12-08T16:06:20.000Z","updated_at":"2024-11-01T15:11:39.000Z","dependencies_parsed_at":"2024-01-16T21:30:15.019Z","dependency_job_id":"e9e93388-4eb1-497c-8220-9fa2aae0f1b6","html_url":"https://github.com/jerr0328/co2mini","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":0.2777777777777778,"last_synced_commit":"4fa44ef4c1ec75d728496c38f0f3508f98f752ca"},"previous_names":["jerr0328/co2-mini"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jerr0328/co2mini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr0328%2Fco2mini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr0328%2Fco2mini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr0328%2Fco2mini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr0328%2Fco2mini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerr0328","download_url":"https://codeload.github.com/jerr0328/co2mini/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr0328%2Fco2mini/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261153916,"owners_count":23116935,"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":["co2-monitor","co2-sensor","co2monitor","hacktoberfest","homekit","prometheus","python3","raspberry-pi"],"created_at":"2025-06-23T00:07:16.031Z","updated_at":"2025-07-07T19:09:46.597Z","avatar_url":"https://github.com/jerr0328.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CO2 monitoring with Prometheus\n\nThis reads from the CO2 Meter and makes it available as a Prometheus service.\nThe core logic comes from [this hackaday article](https://hackaday.io/project/5301-reverse-engineering-a-low-cost-usb-co-monitor/log/17909-all-your-base-are-belong-to-us).\n\n## Setup\n\nNote this assumes you are running on a Raspberry Pi running Raspberry Pi OS (Bullseye)\n\n1. Install Python 3\n2. Install the monitor with `python3 -m pip install co2mini[homekit]` (remove `[homekit]` if you don't use HomeKit)\n3. Set up CO2 udev rules by copying `90-co2mini.rules` to `/etc/udev/rules.d/90-co2mini.rules`\n4. Set up the service by copying `co2mini.service` to `/etc/systemd/system/co2mini.service`\n5. (Optional) Put a configuration file (see Configuration section below) in `/etc/co2mini.env`\n6. Run `systemctl enable co2mini.service`\n\n## Configuration\n\nThe `/etc/co2mini.env` file contains the environment variables used to configure co2mini beyond the defaults.\nThis is mostly necessary when enabling MQTT.\n\nExample:\n\n```bash\nMQTT_ENABLED=true\nMQTT_BROKER=localhost\n```\n\n### MQTT/Home Assistant\n\nThe MQTT feature is meant to work with Home Assistant, although nothing bad will happen if you just want to use the MQTT messages directly.\n\nWhen co2mini starts up, it will send out the discovery message that Home Assistant expects, as well as responding to homeassistant's status when coming online.\nBe sure those are enabled in the Home Assistant MQTT integration (usually is enabled by default) if you have any issues.\n\nTo configure co2mini, the following environment variables are available:\n\nVariable                | Default              | Description\n------------------------|----------------------|---------------------------------------------------------------------------------------------------------\n`NAME`                  | `co2mini`            | This is used for the default display name of the device in Home Assistant\n`MQTT_ENABLED`          | `False`              | Used to enable/disable sending information over MQTT\n`MQTT_BROKER`           | `localhost`          | MQTT Broker hostname\n`MQTT_PORT`             | `1883`               | MQTT broker port number (1883 is the standard MQTT broker port)\n`MQTT_USERNAME`         |                      | Username for authenticating to MQTT broker (leave blank if no authentication is needed)\n`MQTT_PASSWORD`         |                      | Password for authenticating to MQTT broker (leave blank if no authentication is needed)\n`MQTT_DISCOVERY_PREFIX` | `homeassistant`      | Prefix for sending MQTT discovery and state messages.\n`MQTT_RETAIN_DISCOVERY` | `False`              | Flag to enable setting `retain=True` on the discovery messages. You probably don't need this.\n`MQTT_OBJECT_ID`        | `co2mini_{HOSTNAME}` | Override for setting the `object_id` in Home Assistant. Default builds using the hostname of the device.\n\n### Homekit\n\nIf you have the `homekit` dependencies installed, on the first startup you will need to check the logs to get the setup code to integrate with Homekit.\nYou can find the code using `journalctl -u co2mini.service` or possibly by checking the status with `systemctl status co2mini.service`.\n\nNote also that it's sometimes possible that co2mini will have some errors logged and won't be reporting in Homekit anymore.\nIf this happens, it seems like the easiest thing to do is to remove the device from your homekit, remove the `accessory.state` file in your home (`rm accessory.state`) and restart `co2mini` (`sudo systemctl restart co2mini.service`) to get a new code to pair.\n\n## Special notes for Dietpi users\n\n- Be sure to install `Python3 pip` as well (ID `130`)\n- Make sure the dietpi user is in `plugdev` group (`sudo usermod -aG plugdev dietpi`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr0328%2Fco2mini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerr0328%2Fco2mini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr0328%2Fco2mini/lists"}