Skip to content

0.7.0

Choose a tag to compare

@hudsonbrendon hudsonbrendon released this 18 May 00:53
3b822ce

What's New in 0.7.0

Three focused PRs landed since 0.4.0, all backed by tests.

⚙️ OptionsFlow + diagnostics (#81)

Settings → Devices & Services → Hevy → Configure now lets you tune:

  • Polling interval (5–1440 minutes, default 60)
  • Workouts per poll (1–10, default 10)

No reinstall needed — changes take effect on next reload.

New async_get_config_entry_diagnostics powers HA's "Download Diagnostics" button with a sanitized snapshot: api_key redacted from entry data, user identifiers (id/url/name) redacted, exercises dropped from workouts to keep payloads small.

🛠️ Services (#82)

Service What it does
hevy.log_body_measurement POSTs a body measurement to Hevy; falls back to PUT if an entry already exists for that date. Use case: auto-sync your smart scale to Hevy.
hevy.refresh Forces the coordinator to poll immediately. Useful right after logging a workout in the Hevy app.

Both accept an optional entry_id when multiple Hevy integrations are configured.

automation:
  - alias: Sync scale weight to Hevy
    trigger:
      - platform: state
        entity_id: sensor.withings_weight
    action:
      - service: hevy.log_body_measurement
        data:
          weight_kg: "{{ states('sensor.withings_weight') | float }}"
          fat_percent: "{{ states('sensor.withings_fat_ratio') | float }}"

🔄 /workouts/events polling + hevy_workout_updated event (#83)

The coordinator now also polls /v1/workouts/events with a since cursor and fires a new hevy_workout_updated event when a cached workout is edited in the Hevy app (typo fix, set correction, etc).

Combined with Phase 3, the integration now covers the full workout lifecycle:

Lifecycle Event
New workout hevy_workout_completed
Edited workout hevy_workout_updated (new)
Deleted hevy_workout_deleted

Cursor handling is graceful: first refresh seeds the cursor to "now" without polling (no history replay on startup), and events-endpoint failures are logged at DEBUG without blocking the main refresh.

Internals

  • New HevyApiClientConflictError raised on HTTP 409 so service handlers can fall back from POST to PUT cleanly.
  • Coordinator stores workout updated_at on processed records.
  • Workout records exposed via last_workout and workouts dicts gain the updated_at field.

Tests

157 tests passing in ~0.15s (up from 135). New coverage:

  • Diagnostics sanitization + structure
  • Service handlers: entry resolution (single/multi/by id/missing), payload building, POST → 409 → PUT fallback, error wrapping
  • Events endpoint: parameter passthrough, cursor handling, update fires for cached workouts only, API errors swallowed silently

Full diff: v0.4.0...v0.7.0