{"id":21805782,"url":"https://github.com/neluxx/enviro-node-pi","last_synced_at":"2025-03-21T07:43:36.355Z","repository":{"id":238133190,"uuid":"795951703","full_name":"Neluxx/enviro-node-pi","owner":"Neluxx","description":"Python Flask application for collecting environmental sensor data on a Raspberry Pi and sending it to a central hub.","archived":false,"fork":false,"pushed_at":"2025-01-19T12:15:34.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T07:43:30.817Z","etag":null,"topics":["flask","python","raspberrypi"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Neluxx.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":"2024-05-04T13:45:17.000Z","updated_at":"2025-01-19T12:15:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"87b6ddba-7ac4-44cf-9378-36ff986391df","html_url":"https://github.com/Neluxx/enviro-node-pi","commit_stats":null,"previous_names":["neluxx/raspberrypi-sensor-api","neluxx/enviro-node-pi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neluxx%2Fenviro-node-pi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neluxx%2Fenviro-node-pi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neluxx%2Fenviro-node-pi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neluxx%2Fenviro-node-pi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neluxx","download_url":"https://codeload.github.com/Neluxx/enviro-node-pi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244759817,"owners_count":20505710,"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":["flask","python","raspberrypi"],"created_at":"2024-11-27T12:15:37.071Z","updated_at":"2025-03-21T07:43:36.324Z","avatar_url":"https://github.com/Neluxx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# enviro-node-pi\n\nA Python-Flask-based application for collecting environmental sensor data on a Raspberry Pi and sending it to a central hub for further analysis and processing.\n\n## Features\n- **Environmental Data Collection:**\n    - Utilizes the **MH-Z19** sensor for CO₂ detection.\n    - Reads temperature, humidity, and pressure from the **BME680** sensor.\n    - Includes mock sensors for testing without physical hardware.\n\n- **REST API:**\n    - Exposes a Flask RESTful endpoint (`/sensor-data`) to retrieve sensor data.\n    - Sends sensor data to a configured remote API via an HTTP POST request.\n\n- **Error Handling:**\n    - Handles HTTP and network-related errors during data transmission.\n    - Provides meaningful error responses for easier debugging.\n\n## Setup Instructions\n\n### Prerequisites\n- Hardware:\n    - Raspberry Pi\n    - **MH-Z19** and **BME680** sensors (optional for testing).\n- Software:\n    - Python 3.x\n    - Required Python libraries (see [Dependencies](#dependencies)).\n\n### Installation\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/your-username/enviro-node-pi.git\n   cd enviro-node-pi\n   ```\n\n2. Install dependencies using `pip`:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. Create a `.env` file in the project root and specify your central hub API URL:\n   ```\n   API_URL=http://your-central-hub-api-url\n   ```\n\n4. Run the Flask app:\n   ```bash\n   python app.py\n   ```\n\n### Testing with Mock Sensors\nThe app includes mock data for testing when the required sensors are not physically connected. You can use the mock sensor classes to simulate various conditions.\n\n## API Endpoints\n\n### `/sensor-data`\n- **Method:** `GET`\n- **Description:** Retrieves environmental data from sensors and forwards it to the configured API endpoint.\n\n#### Sample Response\n- **Success:**\n  ```json\n  {\n      \"message\": \"Data sent successfully\"\n  }\n  ```\n- **Error:**\n  ```json\n  {\n      \"message\": \"Error sending POST request: [error details]\"\n  }\n  ```\n\n## Dependencies\n- `Flask`: Python web framework.\n- `requests`: For sending HTTP POST requests.\n- Python libraries for sensors (**mh_z19**, **bme680**) when available.\n- `python-dotenv`: For environment variable management.\n\nInstall dependencies:\n```bash\npip install Flask flask-restful requests python-dotenv mh_z19 bme680\n```\n\n## Contributions\nContributions and suggestions are welcome! Please feel free to submit a pull request or open an issue for enhancements or bugs.\n\n## License\nThis project is open-source and available under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneluxx%2Fenviro-node-pi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneluxx%2Fenviro-node-pi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneluxx%2Fenviro-node-pi/lists"}