1 Commits
Author SHA1 Message Date
Marc-Oliver Ochlast 9fb9750ac6 Add per-device night sleep schedule (quiet hours) (#25)
* Add per-device night sleep schedule (quiet hours)

Devices can now be configured with a nightly quiet-hours window. During
the window the display endpoint returns refresh_rate = seconds-until-wake,
so the device deep-sleeps the whole night in one cycle (battery saving, no
nighttime e-ink refreshes) and wakes at the configured time.

Two per-device modes (showSleepScreen):
- false (default): keep the current screen frozen until morning
- true: show a dedicated sleep screen (crescent moon + "Sleeping until HH:MM"),
  generated as a 1-bit e-ink PNG via Sharp (new SleepScreenService)

The window is evaluated in the global DEFAULT_TIMEZONE and supports ranges
that cross midnight. The sleepStartAt/sleepStopAt columns already existed in
the schema; adds showSleepScreen (applied via prisma db push, no migration).
Wires the fields through the device update DTO/service and the device edit
form (toggle + time inputs). Unit tests cover the quiet-hours logic.
2026-07-01 16:33:13 +02:00