{"id":43551658,"url":"https://github.com/pshapiro/cube-alarm-ios","last_synced_at":"2026-02-03T19:34:07.922Z","repository":{"id":307999158,"uuid":"1031276015","full_name":"pshapiro/cube-alarm-ios","owner":"pshapiro","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-03T13:47:03.000Z","size":28276,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T15:28:19.766Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pshapiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-03T11:58:15.000Z","updated_at":"2025-08-03T13:47:07.000Z","dependencies_parsed_at":"2025-08-03T15:28:23.971Z","dependency_job_id":"5e8d16c8-71a1-40c4-be71-6ec70a898aac","html_url":"https://github.com/pshapiro/cube-alarm-ios","commit_stats":null,"previous_names":["pshapiro/cube-alarm-ios"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/pshapiro/cube-alarm-ios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pshapiro%2Fcube-alarm-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pshapiro%2Fcube-alarm-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pshapiro%2Fcube-alarm-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pshapiro%2Fcube-alarm-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pshapiro","download_url":"https://codeload.github.com/pshapiro/cube-alarm-ios/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pshapiro%2Fcube-alarm-ios/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29054762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T15:43:47.601Z","status":"ssl_error","status_checked_at":"2026-02-03T15:43:46.709Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-03T19:34:07.759Z","updated_at":"2026-02-03T19:34:07.917Z","avatar_url":"https://github.com/pshapiro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cube Alarm\n\nThis project turns a GAN Bluetooth cube into an alarm clock. When the alarm rings you must solve your cube to dismiss it!\n\n## Backend (Python)\n\n1. Install dependencies\n   ```bash\n   pip install -r requirements.txt\n   ```\n2. Run the server\n   ```bash\n  python backend/alarm_server.py\n  ```\n\n### Custom alarm sound\n\nThe audio manager loads the alarm sound from the path stored in the\n`ALARM_SOUND_FILE` environment variable.  If this variable is not set, it\ndefaults to `sounds/alarm.wav` relative to the project root.  Adjust this\nvariable to use a custom sound file.\n\n## Frontend (React)\n\n1. Install dependencies\n   ```bash\n   cd frontend\n   npm install\n   ```\n2. Start the dev server\n   ```bash\n   npm start\n   ```\n\n## Getting your cube MAC address\n\nThe backend needs the real BLE MAC address of your cube. Run the BLE worker to scan and note the `Manufacturer MAC` it prints:\n```bash\npython backend/ble_worker.py\n```\nSet this address in a `.env` file or export `CUBE_MAC` before launching the server.\n\n## Raspberry Pi Setup\n\n### Flashing Raspberry Pi OS\n\nUse the [Raspberry Pi Imager](https://www.raspberrypi.com/software/) to write\nRaspberry Pi OS Lite to a microSD card. Boot the Pi, connect it to your network\nthen clone this repo and run `setup_pi.sh`.\nThe script installs the project in `~/cube-alarm` for the user that runs it,\nso ensure you execute it as the user that should own the service.\n\n### Bluetooth\n\nEnable the Bluetooth service and pair your cube if needed:\n\n```bash\nsudo systemctl enable bluetooth\nsudo systemctl start bluetooth\n```\n\n### Audio through the headphone jack\n\nRoute audio to the 3.5mm jack:\n\n```bash\nsudo raspi-config\n```\n\nChoose **Advanced Options → Audio → Headphones**.\n\n### Setting volume\n\nYou can raise the default volume with PulseAudio:\n\n```bash\npactl set-sink-volume 0 80%\n```\n\n### Running the server as a service\n\n`setup_pi.sh` installs a systemd unit named `cube-alarm.service`.\nEnable it at boot and start (or restart) it when needed:\n\n```bash\nsudo systemctl enable cube-alarm.service\nsudo systemctl restart cube-alarm.service\n```\n\nCheck logs with:\n\n```bash\nsudo journalctl -u cube-alarm -f\n```\n\n### Serving the React app with nginx\n\nAfter building the frontend you can serve it with nginx:\n\n```bash\ncd frontend\nnpm install\nnpm run build\nsudo cp -r build/* /var/www/html/\nsudo systemctl enable nginx\nsudo systemctl start nginx\n```\n\n## iOS App (SwiftUI)\n\nA standalone SwiftUI alarm clock lives in the `ios` directory. It schedules local notifications directly on the device and does not require the Python backend or a Raspberry Pi.\n\n1. Open the Swift files in Xcode 15 or later.\n2. Build and run the app in the iOS Simulator or on a physical device.\n3. Grant notification permission when prompted.\n\n\u003e The Linux environment used for this repository cannot compile SwiftUI targets; no automated tests are included.\n\n## Hardware\n\nYou can purchase the GAN cube used for this project here: [GAN Smart Cube](https://amzn.to/4lgux9D).\n\n## API Endpoints\n\nThe backend exposes a small set of HTTP routes for managing alarms and cube state.\n\n- `GET /api/alarms` – retrieve all alarms\n- `GET /api/alarms/active` – list alarms that are currently ringing\n- `POST /api/alarms` – create a new alarm\n- `PUT /api/alarms/\u003cid\u003e` – update an alarm\n- `DELETE /api/alarms/\u003cid\u003e` – delete an alarm\n- `POST /api/alarms/\u003cid\u003e/stop` – stop a specific alarm\n- `POST /api/alarms/stop` – stop all alarms\n\n## Credits\n\nHuge thanks to [afedotov/gan-web-bluetooth](https://github.com/afedotov/gan-web-bluetooth) for the original logic used to communicate with the cube.\n\n## License\n\nThis project is released under the custom license found in `LICENSE.txt`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpshapiro%2Fcube-alarm-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpshapiro%2Fcube-alarm-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpshapiro%2Fcube-alarm-ios/lists"}