Repository navigation
1.0.0
Overview
1.0.0 updates python-google-health-api so callers work directly with native Python datetime and timedelta objects instead of parsing Google's raw Protobuf wire strings ("2026-06-22T08:00:00Z", "3600s", "-25200s"), and adds helpers for computing BMI without duplicate API calls.
Upgrading from 0.x (Breaking Changes)
1. Timestamps are now timezone-aware UTC datetime objects (#79)
All physical timestamps across health metrics, activity intervals, sleep sessions, paired devices (last_sync_time), profiles, and subscribers — including .start_time and .end_time on physical-time records — now return datetime.datetime in UTC instead of ISO 8601 strings.
- Reading data: Remove manual string parsing (such as
datetime.fromisoformat(...)or Home Assistant'sdt_util.parse_datetime(...)) and use thedatetimevalue directly. - Writing data: Pass timezone-aware
datetimeobjects when constructing intervals or samples;.to_dict()automatically serializes them back toZ-normalized RFC 3339 strings for the API. - (Note: Date-only daily summary records like
DailyRestingHeartRatecontinue to represent calendar dates viaDate.)
# Before (0.x)
start = datetime.fromisoformat(point.data.start_time)
# Now (1.0.0)
start = point.data.start_time # already datetime(..., tzinfo=UTC)2. Durations and UTC offsets are now datetime.timedelta objects (#79)
Workout durations, heart-rate zone durations, sedentary and activity-level rollup totals, mobility ground-contact durations, and *_utc_offset fields now return and accept datetime.timedelta instead of Protobuf duration strings like "3600s" or "-25200s".
# Before (0.x)
seconds = float(exercise.active_duration.removesuffix("s"))
# Now (1.0.0)
duration = exercise.active_duration # datetime.timedelta(minutes=45)What's New
- Compute BMI from already-fetched measurements (#80): Applications that already poll weight and height (such as a Home Assistant coordinator) no longer need to make duplicate HTTP requests to calculate BMI:
Bmi.from_measurements(weight, height)computes a singleBmirecord directly fromWeightandHeightmodels.BmiSubApi.compute(weight_points, height_points)aligns timestamps and computesDataPoint[Bmi]records in memory with zero network calls.await api.bmi.list(..., weight_result=..., height_result=...)optionally accepts pre-fetched results while keeping standaloneawait api.bmi.list()unchanged.
- Standard library helpers for civil dates and times (#79): Added
.from_date()/.to_date(),.from_time()/.to_time(), and.from_datetime()/.to_datetime()conversion methods onDate,TimeOfDay, andCivilDateTime. - Improved CLI schema output (#79):
google-health-cli schemanow exposes camelCase JSON property names and wire-format hints (google-datetimeandgoogle-duration).
Full Changelog: 0.10.0...1.0.0