Skip to content

1.0.0

Choose a tag to compare

@allenporter allenporter released this 16 Nov 03:12
· 20 commits to main since this release

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's dt_util.parse_datetime(...)) and use the datetime value directly.
  • Writing data: Pass timezone-aware datetime objects when constructing intervals or samples; .to_dict() automatically serializes them back to Z-normalized RFC 3339 strings for the API.
  • (Note: Date-only daily summary records like DailyRestingHeartRate continue to represent calendar dates via Date.)
# 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 single Bmi record directly from Weight and Height models.
    • BmiSubApi.compute(weight_points, height_points) aligns timestamps and computes DataPoint[Bmi] records in memory with zero network calls.
    • await api.bmi.list(..., weight_result=..., height_result=...) optionally accepts pre-fetched results while keeping standalone await 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 on Date, TimeOfDay, and CivilDateTime.
  • Improved CLI schema output (#79): google-health-cli schema now exposes camelCase JSON property names and wire-format hints (google-datetime and google-duration).

Full Changelog: 0.10.0...1.0.0