Commit Graph
4 Commits
Author SHA1 Message Date
Matthias Jacob 9865b43945 bridge: update README for the Daily Values / Measurements architecture
Replace the outdated /entries-only description with the three-endpoint
model, document daily_totals-based steps sourcing, and move sleep_duration
to "not yet covered" with an explanation of why (not implemented in
Health v3 at all, not just disabled for this user).
2026-09-17 03:49:04 +02:00
Matthias Jacob 2370254e23 bridge: add steps and pulse via Health's Daily Values / Measurements APIs
Health v3 splits writable metrics across three distinct endpoint families
instead of one unified /entries resource (per nextcloud/health's
src/metrics.ts and src/api/*.ts, which are more current than its Markdown
docs): journal entries, one-off measurements, and per-day upserted daily
values.

- weight and steps are Daily Values (PUT /daily-values/{metricKey}/{date});
  steps are sourced from Companion's daily_totals aggregate (already
  deduplicated across sources) instead of summing raw per-window records.
- pulse (heart rate) is a Measurement (POST /measurements); handles both
  raw records and bucketed resolution windows, using the window average
  and a deterministic id for the latter since they carry no HC uuid.
- Both endpoints require an explicit unit (weight: kg, steps: steps,
  pulse: bpm) and Measurements only accept context manual/checkin/checkout,
  not an automation-specific value -- both previously caused 400s.
- sleep_duration is dropped: despite being documented, it isn't an actual
  Daily Value, Measurement, or journal metric in the shipped app (absent
  from GET /configuration entirely).
- Logging now reports per-metric success/failure counts and uses Health's
  metric-key vocabulary consistently instead of mixing in Companion's raw
  payload field names.
2026-09-17 03:48:47 +02:00
Matthias Jacob b3ed4cf430 bridge: configurable Nextcloud request timeout, dynamic Health metric discovery
Auto-detect which Health metrics the instance actually knows and enable
any that are known but disabled for the user, via GET/PUT configuration.
Also makes the previously hardcoded 10s request timeout configurable via
NC_TIMEOUT_SECONDS to accommodate slower instances.
2026-09-17 03:48:07 +02:00
Matthias Jacob 37f3399953 Add minimal Companion-to-Nextcloud-Health bridge (weight only, MVP) 2026-09-17 02:02:34 +02:00