query_heart_rate
Read timestamped heart-rate samples in bpm over a date range, filter by sample_type, and page results from a local Mi Fitness cache. Use for HR history analysis without cloud sync.
Instructions
Read timestamped heart-rate samples in bpm over an inclusive YYYY-MM-DD range, optionally filtering sample_type. Returns data.samples [{timestamp, bpm, sample_type}] and data.count, earliest first. limit defaults to 5000; use a smaller page/date window for large datasets. The cloud adapter normally stores resting/active/passive, so sample_type=workout may be empty; use query_workout_series with a workout_id to analyze all samples in that activity window. Not a diagnosis. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent. Returns data.pagination {limit, offset, has_more, next_offset}; next_offset is null at the end. Keep filters unchanged and avoid syncing between pages.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum records per page (1-5000); count describes this page only. | |
| offset | No | Zero-based position; pass pagination.next_offset unchanged with the same filters. | |
| end_date | Yes | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. | |
| start_date | Yes | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. | |
| sample_type | No | Optional exact stored sample type; omit for all. Cloud records normally use resting/active/passive; for workout-window samples use query_workout_series. |