Goodnight
Apple Health sleep stages in, a phased overnight bed-temperature plan out. On device.
Drag the times to replan the night. This is the engine's plan before it has any Health data; the cycles assume 15% deep and 22% REM sleep.
Goodnight reads your nightly deep, REM and core stages from Apple Health, learns your timing and sleep architecture, and builds a five-phase temperature plan for a cooling pad or smart AC. It grew out of Sleep Optimizer, a web tool and iPhone app that did the same from WHOOP exports.
Why
Smart-bed temperature schedules are locked to specific hardware and cloud accounts, and the manual ones leave you guessing what to set. The data to do better already sits in Apple Health. Goodnight turns it into a plan you can export to Shortcuts, a cooling pad, or an air conditioner, with every setpoint explained.
How it's put together
Trade-offs
Bounded rules over a learned model. Every setpoint carries a rationale and the evidence behind it, so the plan explains itself. Rules have explicit caps and don't depend on order. The downside: It can't discover patterns no one wrote a rule for.
A pure engine in its own Swift package. No side effects, so the scheduling logic is tested without a simulator or the app. The downside: Some state is duplicated in the app layer.
Medians over your good nights. Robust to the occasional 3 a.m. outlier. The downside: Needs a few qualifying nights before it says anything personal.
Fine print
Not medical advice. Temperature effects on sleep stages are modest, and the app says so.
Timezone-aware nights (travel mode, DST tests), a confidence meter, a widget, and a Live Activity for the next setpoint.
Next: Habit FormedA gesture-driven habit tracker whose habits can check themselves off from Apple Health.