{"id":18588030,"url":"https://github.com/hiper2d/smart-home-light-automation-in-python","last_synced_at":"2026-04-09T07:03:55.400Z","repository":{"id":100421792,"uuid":"374435779","full_name":"hiper2d/smart-home-light-automation-in-python","owner":"hiper2d","description":"Design of smart light network for home using Raspberry Pi, ESP8266 WiFi modules, and Python","archived":false,"fork":false,"pushed_at":"2023-05-15T04:00:28.000Z","size":1800,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T19:11:40.521Z","etag":null,"topics":["angular12","esp8266","flask","micropython","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hiper2d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-06-06T18:31:46.000Z","updated_at":"2024-02-24T21:15:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"a288cd5d-1733-4624-bcbd-93f3ca8e4d45","html_url":"https://github.com/hiper2d/smart-home-light-automation-in-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiper2d%2Fsmart-home-light-automation-in-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiper2d%2Fsmart-home-light-automation-in-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiper2d%2Fsmart-home-light-automation-in-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiper2d%2Fsmart-home-light-automation-in-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiper2d","download_url":"https://codeload.github.com/hiper2d/smart-home-light-automation-in-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485045,"owners_count":22078767,"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":["angular12","esp8266","flask","micropython","raspberry-pi"],"created_at":"2024-11-07T00:44:27.980Z","updated_at":"2025-12-30T23:04:57.548Z","avatar_url":"https://github.com/hiper2d.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart light control system in home WiFi network\n\n### Goals\n* Design devices (hardware and firmware) that can be controlled over a web application in a home WiFi network\n* Each device based on ESP8266 WiFi module\n* Raspberry Pi 4 server to control devices and to host a web client\n* So far, devices are RGB lights but I plan to add more types in the future. The next type is a sensor\n\n### Project structure\n* [Frontend](frontend/README.md) and [Backend](raspberrypi): Website in Angular 15 server by Python/Flask webserver hosted on Raspberry Pi server to control devices\n* [Mosquitto](mosquitto/README.md): Mosquitto messaging queue for MQTT communication between\n* [ESP8266](esp8266) firmware in MicroPython for devices\n* SMD5050 RGB LED Strip Lights as controlled devices\n* Electrical circuits and diagrams of devices\n* Guidance of how to setup this all\n\nThis is how the web interface looks like for now:\n![interface](./images/interface.png)\n\n# Build Images\n\nTo build docker images, install Docker, Docker Compose and run the following:\n```bash\ndocker-compose build\n```\n\nYou can update the image name for `backend` and `frontend` services with your DockerHub repository and push the images into your repo:\n```bash\ndocker-compose push\n```\n\nDelete all existing containers and images:\n```bash\ndocker rm -vf $(docker ps -aq)\ndocker rmi -f $(docker images -aq)\n```\n\n# Installation to Raspberry Pi\n\n### Raspberry Pi\n\nJust install clone the repository into some folder on Raspberry Pi and start it using `docker-compose`:\n```bash\ndocker-compose up\n```\n\nIt's required to install Docker and Docker Compose to Raspberry Pi and open the MQTT server port and Nginx frontend webserver port:\n```bash\n# Open Mosquitto ans Nginx ports:\nsudo ufw allow 1883/tcp\nsudo ufw allow 1883/udp\nsudo ufw allow 8080/tcp\nsudo ufw allow 8080/udp\n```\n\n# Prepare Development Environment\n\nTo work with this project as a programmer, you need to have Python 3, Node.js installed. You also need Docker and Docker compose\n\nYou can run it from Docker images. Use `--build` to rebuild igamges from the source code before ruggin:\n```bash\ndocker-compose --build up\n```\nIn this case the main UI is available at the port 8080\n\nOr run only the Mosquitto server form a container. `frontend`, `backend` server can be started in a terminal or from IDE:\n```bash\n# from the project root directory\ndocker-compose up mosquitto\n# from the frontend directory\nng serve --host 0.0.0.0 --port 80\n# from the backend directory\npython3 backend/website.py\n```\nIn this case the main UI is available at the port 80\n\n### ESP8266\n\n1. Use the [official guide](https://docs.micropython.org/en/v1.14/esp8266/tutorial/intro.html) of installing MicroPython to a ESP8266. Finding a serial port may be tricky. Before connecting the ESP8266 to Raspberry Pi run the following:\n\n   ```bash\n   ls -l /dev/ttyUSB*\n   ```\n   \n2. Edit MicroPython scripts in the `esp8266` project's directory:\n   - *boot.py*: update `ssid` and `password` with your local home WiFi network name and password\n   - *main.py* update `mqtt_server` with your Raspberry Pi IP address in the home network\n   \n3. Copy all 4 files from the `esp8266` project's directory\n\n# Circuit diagram\n\n![circuit diagram](./images/circuit_diagram.jpg)\n\n### List of components\n\n1. 1 x ESP8266 NodeMCU development board\n2. 1 x SMD 5050 RGB LED strip - 1\n3. 3 x TIP120 NPN transistor\n4. 3 x 180-240 Ohm resistor\n5. 1 x Mini-360 DC-DC buck converter\n6. 1 x 1N914 switching diode\n7. 1 x 12V 3A power supply\n\n# How this all Works\n\nDiagram with no text explanation for now about the device register process:\n\n![smart light ping](./images/smart_light_ping.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiper2d%2Fsmart-home-light-automation-in-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiper2d%2Fsmart-home-light-automation-in-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiper2d%2Fsmart-home-light-automation-in-python/lists"}