Eight Sleep Sleep Efficiency
eight_sleep_efficiencyComputes sleep efficiency (asleep vs in-bed) for each of the last N nights, providing mean, median, min, max, band breakdown, and natural-language observations on trends.
Instructions
v0.2.2 — Sleep efficiency calculator. For each of the last N nights (default 7), computes time_in_bed_minutes (from presenceDuration), time_asleep_minutes (from sleepDuration), efficiency_pct = (asleep / in_bed) * 100, and efficiency_band (excellent ≥85, good 75-84, fair 65-74, poor <65). Returns nights_analyzed, mean / median / min-night / max-night efficiency, a nights_by_band breakdown, per_night array, and natural-language observations (mid-week drop, all-nights-same-band, single-night dip > 15 points below mean) ONLY when supported by the data. Reuses the existing /v1/users/{id}/trends payload — no extra API calls. Graceful degradation when upstream omits presenceDuration / sleepDuration (returns nights_analyzed: 0 with a clarifying note).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nights | No | Number of recent nights to analyze. Default 7. | |
| timezone | No | IANA timezone for grouping nightly records. Default UTC. | UTC |
| response_format | No | markdown |