{"id":30891200,"url":"https://github.com/konggithubdev/lightapplicationcontrol","last_synced_at":"2026-05-01T18:33:02.958Z","repository":{"id":311112934,"uuid":"1042510137","full_name":"KongGithubDev/LightApplicationControl","owner":"KongGithubDev","description":"ESP32 + Android Kotlin app controlling a light via MQTT (HiveMQ). Arduino firmware handles ON/OFF/STATUS; Android app publishes/reads state.","archived":false,"fork":false,"pushed_at":"2025-08-22T06:32:35.000Z","size":556,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-22T08:28:44.100Z","etag":null,"topics":["arduino","esp32","hivemq","kotlin","mqtt","mqtt-client","smart-light","wifi"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/KongGithubDev.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,"zenodo":null}},"created_at":"2025-08-22T06:11:05.000Z","updated_at":"2025-08-22T06:33:29.000Z","dependencies_parsed_at":"2025-08-22T08:40:15.589Z","dependency_job_id":null,"html_url":"https://github.com/KongGithubDev/LightApplicationControl","commit_stats":null,"previous_names":["konggithubdev/lightapplicationcontrol"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/KongGithubDev/LightApplicationControl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KongGithubDev%2FLightApplicationControl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KongGithubDev%2FLightApplicationControl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KongGithubDev%2FLightApplicationControl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KongGithubDev%2FLightApplicationControl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KongGithubDev","download_url":"https://codeload.github.com/KongGithubDev/LightApplicationControl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KongGithubDev%2FLightApplicationControl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274225655,"owners_count":25244555,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arduino","esp32","hivemq","kotlin","mqtt","mqtt-client","smart-light","wifi"],"created_at":"2025-09-08T18:04:08.118Z","updated_at":"2026-05-01T18:33:02.884Z","avatar_url":"https://github.com/KongGithubDev.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Light Application Control (ESP32 + Android MQTT)\n\nThis project demonstrates controlling a light state via MQTT between an ESP32 (Arduino) device and an Android application.\n\n- ESP32 firmware is in `main.ino`. It connects to Wi‑Fi, subscribes to `esp32/light_control` on HiveMQ public broker, and reacts to commands: `ON`, `OFF`, `STATUS`.\n- Android app (Kotlin) is in `App/LightControlApplication/`. It uses Eclipse Paho MQTT to publish/subscribe on the same topic and display or control the state.\n\n## Features\n- MQTT communication over public broker (`broker.hivemq.com:1883`)\n- Commands: `ON`, `OFF`, `STATUS`\n- Status messages from ESP32: `STATUS_ON` or `STATUS_OFF`\n- Auto-reconnect for ESP32 when MQTT connection is lost\n\n## Repository Structure\n- `main.ino` — ESP32 Arduino sketch\n- `App/LightControlApplication/` — Android app module (Gradle/Kotlin)\n- `LICENSE` — License for this repository\n- `.gitignore` — Git ignore rules for Android + Arduino\n\n## Prerequisites\n### Hardware\n- ESP32 development board\n- USB cable\n\n### Software\n- Arduino IDE (or Arduino CLI)\n- Android Studio (Arctic Fox or newer)\n\n### Arduino Libraries\n- `WiFi.h` (bundled with ESP32 board support)\n- `PubSubClient` (by Nick O'Leary)\n\nInstall ESP32 board support in Arduino IDE via Boards Manager, and install PubSubClient via Library Manager.\n\n## ESP32 Setup and Upload\n1. Open `main.ino` in Arduino IDE.\n2. Configure your Wi‑Fi:\n   - Edit `ssid` and `password` in `main.ino` to match your network.\n3. Select Board and Port:\n   - Tools → Board → ESP32 Arduino → your ESP32 model\n   - Tools → Port → your device port\n4. Upload the sketch.\n5. Open Serial Monitor at 115200 baud to see connection logs and status messages.\n\nThe sketch:\n```cpp\n// Topic used by both ESP32 and Android app\nconst char* topic = \"esp32/light_control\";\n// Commands expected from Android: ON | OFF | STATUS\n// Status published by ESP32: STATUS_ON | STATUS_OFF\n```\n\n## Android App Setup (Kotlin)\n1. Open `App/LightControlApplication/` in Android Studio.\n2. Let Gradle sync. Ensure internet permission exists in the app manifest if you add UI activities.\n3. The MQTT service is implemented in `app/src/main/java/com/demo/lightcontrolapplication/MqttService.kt` using Eclipse Paho client.\n4. Run the app on a device/emulator with internet access.\n\n### MQTT Details\n- Broker: `broker.hivemq.com`\n- Port: `1883`\n- Topic: `esp32/light_control`\n- Client IDs: Randomized for both ESP32 and Android to avoid conflicts.\n\n## Usage\n- From the Android app, publish `ON` or `OFF` to toggle the ESP32 light state.\n- Publish `STATUS` to request the current state.\n- ESP32 publishes `STATUS_ON` or `STATUS_OFF` whenever state changes or upon status request.\n\n## Security Notes\n- Replace the default Wi‑Fi credentials in `main.ino` before committing code to any public repository.\n- Public brokers are for testing only. For production, host your own MQTT broker with TLS and authentication.\n- Do not commit secrets (keystores, API keys). `.gitignore` is configured to help avoid accidental commits.\n\n## Troubleshooting\n- If ESP32 fails to connect to Wi‑Fi: verify SSID/password and 2.4GHz availability.\n- If MQTT connect fails: public brokers can rate‑limit; wait and retry or use your own broker.\n- Ensure both ESP32 and Android use the exact same topic `esp32/light_control`.\n- Check that corporate/VPN/firewall does not block port 1883.\n\n## License\nThis project is licensed under the terms in `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonggithubdev%2Flightapplicationcontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonggithubdev%2Flightapplicationcontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonggithubdev%2Flightapplicationcontrol/lists"}