wake-alarm/README.md
Krzysztof kuhy Rudnicki 407d7cbf8f Extract wake_alarm from testsAndMisc as a standalone repo
Rewrites python_pkg.wake_alarm imports to wake_alarm, vendors the
shared configure_logging helper, drops the monorepo PYTHONPATH from
install.sh and the systemd unit (package is now pip-installed), and
untracks wake_state.json (runtime HMAC state, now gitignored). Scaffolds
standalone lint/test config copied from the already-corrected diet_guard
scaffold (pylint --fail-under=10 with tests excluded and the
use-implicit-booleaness/consider-using-with disables, mypy's actual
disabled-error-code set, ruff ALL, bandit, 100% branch coverage), plus
the wave.Wave_write generated-members fix this package's _audio.py needs.
2026-06-22 12:31:40 +02:00

1.3 KiB

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.