Go to file
Krzysztof kuhy Rudnicki 512fdd5c95
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
Migrate phone_app alarm sync from GitHub Gist to crdt_sync
phone_app: the alarm now syncs through the shared crdt_sync transport
(v0.2.0) into the fixed private repo kuhyx/syncs, replacing the bespoke
Gist. AlarmSyncService is the sole writer: it holds the alarm locally in a
crdt_sync LogStore (one HLC-stamped Record) and pushes it to
wake-alarm-sync/devices/phone/alarm.json. gist_service.dart is deleted;
SyncSettings drops the Gist id and keeps only a token; the device-flow scope
moves from `gist` to `repo` (the Contents API needs private-repo access).

shutdown-wrapper.sh: the PC reader now fetches that alarm from the Contents
API (Accept: application/vnd.github.raw, so no base64) and parses the
crdt_sync Record Log with jq (.alarm.fields.alarm_hour[0]). Single-file read
of the sole "phone" device; unchanged fallback to WAKE_AFTER_HOURS on any
miss so a parse failure can never brick the wake. Config moves from
gist_sync.json {token, gist_id} to sync.json {token}.

Verified: flutter analyze clean + tests pass; shellcheck clean and the full
get_synced_alarm_epoch verified against the real Log format; on-device the
app builds, installs with adb install -r (no data loss), launches and
renders. Live round-trip needs a one-time repo-scoped re-auth on the phone
and ~/.config/wake_alarm/sync.json on the PC.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019KwUCPESvE5CjCtmUFz8xQ
2026-07-11 22:45:14 +02:00
.github/workflows Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
phone_app Migrate phone_app alarm sync from GitHub Gist to crdt_sync 2026-07-11 22:45:14 +02:00
scripts Add CI-mirror pre-push gate + requirements-sync check 2026-07-11 17:51:16 +02:00
wake_alarm Replace sleep-and-hope audio waits with per-cycle presence checks 2026-07-11 18:51:03 +02:00
.gitignore Add CI-mirror pre-push gate + requirements-sync check 2026-07-11 17:51:16 +02:00
.pre-commit-config.yaml Add CI-mirror pre-push gate + requirements-sync check 2026-07-11 17:51:16 +02:00
CLAUDE.md Document the durable-clone editable-install requirement 2026-06-22 12:54:27 +02:00
install.sh Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
pyproject.toml Point gatelock at the consolidated utils monorepo 2026-07-10 14:01:43 +02:00
README.md Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
requirements.txt Point gatelock at the consolidated utils monorepo 2026-07-10 14:01:43 +02:00
shutdown-wrapper.sh Migrate phone_app alarm sync from GitHub Gist to crdt_sync 2026-07-11 22:45:14 +02:00
sleep-hook.sh Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
wake-alarm-fans.sh Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
wake-alarm.service Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00

wake_alarm

A hibernate-scheduled weekend wake alarm: the machine hibernates overnight on alarm days and wakes itself via rtcwake, then shows a fullscreen, challenge-dismissed alarm with fan ramp and optional TP-Link Tapo P110 smart-plug control.

Install

bash install.sh

This installs the package + dependencies into system Python's user site-packages (the systemd service runs /usr/bin/python directly, not a venv — see CLAUDE.md), installs the systemd user service, the systemd-sleep resume hook, the shutdown wrapper that triggers hibernate on alarm nights, the fan-ramp script, and (optionally) python-kasa for smart-plug control.

Usage

python -m wake_alarm._alarm --demo   # test the alarm window (safe, closeable)

The alarm fires automatically via the hibernate/wake cycle once installed; no manual invocation is needed in normal operation.

Development

python -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/pre-commit install && .venv/bin/pre-commit install --hook-type pre-push
.venv/bin/python -m pytest wake_alarm/tests/ --cov=wake_alarm --cov-branch --cov-fail-under=100

See CLAUDE.md for scheduling details, the hibernate/rtcwake mechanism, the cross-repo workout_log.json read, and production deployment gotchas.