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.
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.