Commit Graph
29 Commits
Author SHA1 Message Date
Gideon ZenzandMerow 92f0a7d802 Add data export for HC sync verification tooling as debug function 2026-03-02 20:24:53 +01:00
Gideon Zenz b5b0b585cc Fix #5797: Advance HC sync cursor by last-written record timestamp
The sync state cursor was advancing to the slice end timestamp
unconditionally, even when no records were written. Late-arriving data
(sleep, workouts, VO2Max, etc.) that arrives after the cursor has
already advanced past it would be permanently skipped.
Each syncer now reports the latest timestamp of records actually
inserted into Health Connect. The sync cursor advances to
max(currentPersisted, latestRecordTimestamp) instead of
sliceEndTimestamp. If no records were written for a slice, the cursor
stays put. This handles all late-arriving data generically without
needing per-data-type special-casing.
2026-03-02 20:19:02 +01:00
Gideon Zenz 3f59815f5f Hide heart rate monitoring config for Helio Strap (always-on by design) 2026-02-14 18:27:17 +01:00
Gideon Zenz 3c8a9b5821 Enable Sony WF1000XM4 Headphones speak-to-chat support 2026-02-14 07:50:33 +01:00
Gideon ZenzandJosé Rebelo 14aadfe0a0 Implement the mac address changing feature in the debug settings 2026-02-08 19:16:28 +01:00
Gideon ZenzandJosé Rebelo b42db53109 Add "Today" and "distant past" quick filter option to workout list with persistent selection
- Add "Today" and "distant past" option to time period filter dropdown
- Store selected filter in SharedPreferences for persistence across sessions
- Auto-restore last selected filter when opening workout filter settings
- Today filter shows workouts from midnight to current time, distant pass shows all workouts
2026-01-25 16:58:00 +01:00
Gideon ZenzandJosé Rebelo a486de73c5 Parse workout summaries upfront to ensure correct activityKind before processing 2026-01-16 22:12:23 +01:00
Gideon ZenzandJosé Rebelo 3bebe6563d Fix cadence syncing to only sync for appropriate activity types
Use ActivityKind.getCycleUnit() to determine if cadence should be synced.
Only sync StepsCadenceRecord for step-based activities (walking, running, hiking) and CyclingPedalingCadenceRecord for cycling activities.
Skip cadence syncing for activities with other cycle units (strokes, jumps, reps, swings) as Health Connect lacks appropriate cadence record types.

Note: Swimming workouts with stroke data (freestyle, backstroke, etc.) could be synced as ExerciseSegment records in a future enhancement.
2026-01-16 22:12:23 +01:00
Gideon ZenzandJosé Rebelo 46925c2dde Add missing workout data sync: active calories, steps, and cadence
- Fix calorie mapping: caloriesBurnt represents active calories, not total calories
- Parse RAW_SUMMARY_DATA when SUMMARY_DATA JSON is empty (fixes Amazfit/ZeppOS devices)
- Use device-specific ActivitySummaryParser to extract workout metrics from binary protobuf data
- Sync ActiveCaloriesBurnedRecord separately from total calories
- Add StepsRecord for step count during workouts
- Add intelligent cadence syncing (StepsCadenceRecord for running/walking, CyclingPedalingCadenceRecord for cycling)
- Add required Health Connect permissions to manifest
- Update HealthConnectPermissionManager with all workout permissions
2026-01-16 22:12:23 +01:00
Gideon Zenz 9c85d5995c Zepp OS: Enable workout detection sensitivity for Helio Strap
- Add supportsWorkoutActivityTypesConfiguration() to enable workout settings for devices without display
- Add supportsWorkoutDetectionCategories() to control visibility of workout categories
- Update ZeppOsSettingsCustomizer to hide workout categories preference for devices that don't support it
- Enable workout detection sensitivity configuration for Amazfit Helio Strap
- Workout categories selector is hidden for Helio Strap, only alert and sensitivity settings are shown
This allows the Helio Strap to configure automatic workout detection sensitivity despite having no display.
2026-01-04 17:14:51 +01:00
Gideon Zenz 3fe147247e Fix last sample sync issue by making slice boundaries inclusive
Changed boundary checks from exclusive [start, end) to inclusive [start, end] to ensure samples occurring exactly at slice boundaries are synced correctly. This fixes the issue where the last sample in the database would never get synced because it was filtered out by the exclusive end boundary check while the sync state advanced to its timestamp.

Affected syncers:
- AbstractTimeSampleSyncer (HRV, SpO2, Weight, etc.)
- StepsSyncer
- HeartRateSyncer
- SleepSyncer
2026-01-04 14:50:47 +01:00
Gideon Zenz 687b812ed4 Fix workout sync to track end time instead of start time for last synced position
Changed getLastSampleTimestamp() for WORKOUTS to use workout EndTime instead of
StartTime. Previously, using StartTime caused the sync state to advance only to
the start of the last workout, resulting in that workout being re-synced on every
sync run and any new workouts started after it being missed until the next sync.
Now correctly advances to workout end time, ensuring proper incremental sync.
2026-01-04 13:54:25 +01:00
Gideon ZenzandJosé Rebelo 2e582f48c6 Health Connect: Refactor HrvSyncer, Vo2MaxSyncer, and WeightSyncer to use AbstractTimeSampleSyncer 2026-01-03 14:37:37 +00:00
Gideon ZenzandJosé Rebelo 1bdf0bd130 fix timestamp issues 2026-01-03 15:03:21 +01:00
Gideon ZenzandJosé Rebelo fd29be7b4a - Filter WORKOUTS from sync iteration since it's only for permission grouping
- Move RecordedWorkoutSyncer outside activityBasedSamples null check
2026-01-03 15:03:21 +01:00
Gideon ZenzandJosé Rebelo 2e5a77e541 Add missing Health Connect permissions and WORKOUTS data type
- Add PERMISSION_WRITE_EXERCISE_ROUTE import to HealthConnectPermissionManager
- Include ElevationGainedRecord, PowerRecord, SpeedRecord, and ExerciseRoute permissions in requiredHealthConnectPermissions
- Add WORKOUTS enum to HealthConnectDataType with comprehensive permission mapping
- Handle WORKOUTS branches in HealthConnectUtils when expressions for exhaustiveness
2026-01-03 15:03:21 +01:00
Gideon ZenzandJosé Rebelo aea638d4be Adding HealthConnect sync for:
Body Temperature
    Skin Temperature
    Distance
    Exercise
    Heart rate
    Heart rate variability
    Oxygen saturation
    Sleep
    Steps
    Total calories burned
    VO2 max
    Weight

The feature is configurable via Settings->External Integrations->Health Connect

Based on https://codeberg.org/LLan/Gadgetbridge

Kudos to LLan for the preliminary work!
2026-01-03 15:03:21 +01:00
Gideon ZenzandJosé Rebelo 40137ef9e7 Ignore devices that don't support HRV measurements 2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo 3b4b7292c3 Invalidate HRV cache based on latest sample timestamp
Query latest HRV sample to invalidate also yesterday if needed
2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo 68f12ea92e Invalidate HRV summary cache when new data arrives
Add HrvCacheInvalidationReceiver to listen for ACTION_NEW_DATA broadcasts and invalidate the computed HRV summary cache for the current day.
2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo 9ef4942102 Add HRV summary computation for Huawei devices
Uses ComputedHrvSummarySampleProvider to generate HRV summary statistics
from per-minute HRV values stored by Huawei devices.
2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo ca532a6350 Implemented a static, thread-safe LRU cache that persists across provider instances: 2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo 290379a462 - Use SleepAnalysis for last night HRV calculation
- remove ColmiHrvSummarySampleProvider
2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo 0c7a2c3960 Adding Yawell Rings 2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo 8c0b8934ee Require minimum 7 days of overnight HRV data before calculating baseline status to prevent unreliable POOR status in first few days 2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo 9df32ad1ac Generic provider creation
Garmin algorithm implementation
POOR status addition
Caching for performance
Application to both Huami and Ultrahuman devices
2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo c0f5da073e Add HRV summary computation for Huami/Zepp OS devices
Implements HuamiHrvSummarySampleProvider to compute HRV summary statistics
on-demand from per-minute HRV value samples. Calculates weekly averages,
last night values, baselines, and HRV status (LOW/UNBALANCED/BALANCED).

This enables full HRV dashboard and status screen functionality for devices
that only provide raw HRV measurements without pre-computed summaries.

- Created HuamiHrvSummarySampleProvider with computed summary logic
- Added getHrvSummarySampleProvider() override in HuamiCoordinator
- Computes 7-day rolling average, last-night stats, and 14-day baselines
- Works retroactively with existing historical HRV data
2025-12-20 19:07:34 +01:00
Gideon ZenzandJosé Rebelo d10ad8b650 Finalizing device temperature and adding device location implementation 2025-10-20 00:38:34 +02:00
Gideon ZenzandJosé Rebelo d869eae55c Add DeviceKind (#5382)
Adding DeviceKinds to DeviceCoordinators as introduced by https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/5346

Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/5382
Co-authored-by: Gideon Zenz <gzenz@gmx.de>
Co-committed-by: Gideon Zenz <gzenz@gmx.de>
2025-09-23 23:23:20 +02:00