{"id":17601152,"url":"https://github.com/jipelski/smart-home","last_synced_at":"2026-04-13T01:38:05.685Z","repository":{"id":258570363,"uuid":"865032824","full_name":"jipelski/smart-home","owner":"jipelski","description":"Smart home management system using Raspberry Pi 4, Pico-W, and sensors such as BME688","archived":false,"fork":false,"pushed_at":"2024-10-18T12:46:59.000Z","size":2282,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T22:24:59.293Z","etag":null,"topics":["aiomqtt","asyncpg","ble","bme688","micropython-rpi-pico","mqtt-client","raspberry-pi-4","raspberry-pi-pico-w","redis","redis-pubsub-channel"],"latest_commit_sha":null,"homepage":"","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/jipelski.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-09-29T20:02:13.000Z","updated_at":"2024-10-18T12:47:03.000Z","dependencies_parsed_at":"2024-10-19T16:27:20.152Z","dependency_job_id":null,"html_url":"https://github.com/jipelski/smart-home","commit_stats":null,"previous_names":["jipelski/smart-home"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jipelski%2Fsmart-home","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jipelski%2Fsmart-home/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jipelski%2Fsmart-home/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jipelski%2Fsmart-home/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jipelski","download_url":"https://codeload.github.com/jipelski/smart-home/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249222,"owners_count":20747167,"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":["aiomqtt","asyncpg","ble","bme688","micropython-rpi-pico","mqtt-client","raspberry-pi-4","raspberry-pi-pico-w","redis","redis-pubsub-channel"],"created_at":"2024-10-22T12:08:49.068Z","updated_at":"2026-04-13T01:38:00.658Z","avatar_url":"https://github.com/jipelski.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Home Automation System\n\n# Overview\n\nThe **Smart Home Automation System** is an IoT-based application designed to collect environmental data from various sensors and manage various IoT devices. It provides real-time updates, historical data, and allows users to have a better understanding of their enviroment. In later versions, it will allow users to create routines for a range of IoT devices such as actuators, switches, radios, etc.\n\n# Architecture Overview\n\u003cimg src=\"./assets/Smart_Home_Flowchart.png\" alt=\"Smart Home Flowchart\"/\u003e\n\n# Project Structure\n```\nsmart-home/\n|   .gitignore\n|   LICENSE\n|   README.md\n|\n+---assets\n|       Hub_Service_Flowchart.svg\n|       PicoWHwiring.png\n|       Smart_Home_Flowchart.png\n|       Smart_Home_Flowchart.svg\n|       postgres_erd.svg\n|\n+---back_end\n|   +---back_end\n|   |   |   docker-compose.yml\n|   |   |   init.sql\n|   |   |   mosquitto.conf\n|   |   |\n|   |   +---app\n|   |   |   |   database.py\n|   |   |   |   dockerfile\n|   |   |   |   main.py\n|   |   |   |   README.md\n|   |   |   |   requirements.txt\n|   |   |   |   __init__.py\n|   |   |   |\n|   |   |   +---models\n|   |   |   |     hub.py\n|   |   |   |     sensor.py\n|   |   |   |\n|   |   |   +---routes\n|   |   |   |     health.py\n|   |   |   |     hub.py\n|   |   |   |     sensor.py\n|   |   |   |     websocket.py\n|   |   |   |\n|   |   |   |\n|   |   |   +---services\n|   |   |         db_service.py\n|   |   |         mqtt_service.py\n|   |   |         websocket_manager.py\n|   |   |\n|   |   |\n|   |   +---celery_service\n|   |   |       celery_config.py\n|   |   |       Dockerfile\n|   |   |       Dockerfile.beat\n|   |   |       requirements.txt\n|   |   |       tasks.py\n|   |   |\n|   |   +---mqtt_to_redis\n|   |   |       .envexample\n|   |   |       dockerfile\n|   |   |       mqtt_to_redis.py\n|   |   |       README.md\n|   |   |       requirements.txt\n|   |   |\n|   |   |\n|   |   +---redis_to_db\n|   |         .envexample\n|   |         dockerfile\n|   |         README.md\n|   |         redis_to_db.py\n|   |         requirements.txt\n|   |\n|   \\---tests\n+---hub\n|   |   README.md\n|   |\n|   +---hub\n|   |       .envexample\n|   |       ble.log\n|   |       ble_client.py\n|   |       config.py\n|   |       dockerfile\n|   |       hub_manager.py\n|   |       main.py\n|   |       requirements.txt\n|   |       __init__.py\n|   |\n|   \\---test\n|\n\\---sensors\n    \\---BME688PICOWH\n            ble.py\n            bme680.py\n            main.py\n            README.md\n```\n\n# Database Relationship Diagram\n\u003cimg src=\"./assets/postgres_erd.svg\" alt=\"Database Relationship Diagram\"/\u003e\n\n# Features\n  - **Environmental Monitoring**: Collects various environmental data using sensors.\n  - **Real-Time Data Streaming**: Provides live updates through WebSockets.\n  - **Historical Data**: Stores data in PostgreSQL for historical analysis.\n  - **Modular Architecture**: The project is composed of independent, decoupled modules for sensors, hubs, and backend services.\n  - **Scalable and Extensive**: The system is designed to allow horizontal scaling for most modules and physical devices such as sensors and hubs.\n\n# Services\n## Sensor Modules\n### BME688 sensor on Pico W\n\u003ca href=\"sensors/BME688PICOWH/README.md\"\u003eBME688 ReadMe file\u003c/a\u003e\n\nCollects environmental data and transmits it over BLE to a central hub specific to that location.\n\n**Data Collected**\n- Temperature\n- Humidity\n- Pressure\n- Gas Resistance\n\n**Communication**\n- Uses BLE to send data to a connected central hub through notifications.\n\n## Hub Service\n\u003ca href=\"hub/README.md\"\u003eHub Service ReadMe file\u003c/a\u003e\n\nDesigned to act as a bridge between the sensor peripherals and the backend services.\nMultiple instances can be deployed to monitor multiple locations at once.\n- **BLE Connectivity**: Connects to sensors using Bleak and communicates with them using BLE.\n- **Data Handling**: Data received is unpacked and prepared for transmission.\n- **MQTT Integration**: Sends and receives data from the backend through an MQTT broker.\n\n## Backend Services\n\n**FastAPI Application**\n  - Provides RESTful and WebSocket endpoints for clients to retrieve data and command hubs. # Later on will provide endpoints for controlling different types of IoT devices.\n  - \u003ca href=\"back_end/back_end/app/README.md\"\u003eApp Service ReadMe file\u003c/a\u003e\n\n**MQTT to Redis Service**\n  - Handles incoming data from hubs and pushes it to a Redis Stream.\n  - \u003ca href=\"back_end/back_end/mqtt_to_redis/README.md\"\u003eMQTT to Redis service ReadMe file\u003c/a\u003e\n\n**Redis to Db Service**\n  - Reads data from Redis Streams, processes it, stores it in the appropriate table of the PostgreSQL database, and publishes sensor id specific updates via Redis Pub/Sub.\n  - \u003ca href=\"back_end/back_end/redis_to_db/README.md\"\u003eRedis to Db Services ReadMe file\u003c/a\u003e\n\n**Celery Service**\n  - Runs data aggregation tasks periodically.\n\n## Setup and Installation\n### Prerequisites\n**Hardware**\n  - **BME688 mounted on Pico W** (only available sensor at the moment)\n  - **Raspberry Pi 4 model B** (or any BLE-capable device that can run 24/7)\n  - `Optional` Hetzner Cloud Server\n\n**Software**\n  - **Python 3.11** or higher\n  - **Docker** and **Docker Compose**\n  - **MQTT Broker** (`Eclipse Mosquitto` or `HiveMQ`)\n  - **Redis Server**\n  - **PostgreSQL Server**\n\n**Installation**\n  - **Clone the Repository**\n    ```\n      git clone https://github.com/jipelski/smart-home.git\n      cd smart-home\n    ```\n**Setting up the Sensor Module**\n  - Access the appropriate ReadMe.md file for your specific sensor in the sensors \u003ca href=\"sensors/\"\u003erepository\u003c/a\u003e for the setup instructions.\n\n**Setting up the Hub Service**\n  - Navigate to the \u003ca href=\"hub/\"\u003ehub\u003c/a\u003e directory and follow the ReadMe file instructions.\n\n**Setting up the Backend Services**\n  - Ensure you have an appropriate `.env` file, `init.sql`, and `mosquitto.conf` file in your repository.\n  - Run docker compose command:\n  - `docker compose up`\n\n# Usage\n## Accessing the Web Interface\nOpen your browser and navigate to `https://localhost:8000/docs` to access the FastAPI application.\n\n## API endpoints\nAn extensive list of the API endpoints can be found \u003ca href=\"back_end/back_end/app/README.md#api-endpoints\"\u003ehere\u003c/a\u003e.\n\n# License\nThis project is licensed under the MIT License - see the \u003ca href=\"LICENSE\"\u003eLicense\u003c/a\u003e for more details.\n\n# Acknowledgements\n  - **Adafruit**: for providing sensor libraries.\n  - **Bleak**: For the BLE client library used.\n  - **FastAPI**: For the web framework.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjipelski%2Fsmart-home","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjipelski%2Fsmart-home","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjipelski%2Fsmart-home/lists"}