Skip to content

Huawei Scale 3: add realtime body composition support - #1492

Open
Stefanos1000 wants to merge 1 commit into
oliexdev:masterfrom
Stefanos1000:huawei-scale3-realtime-body-composition
Open

Huawei Scale 3: add realtime body composition support#1492
Stefanos1000 wants to merge 1 commit into
oliexdev:masterfrom
Stefanos1000:huawei-scale3-realtime-body-composition

Conversation

@Stefanos1000

Copy link
Copy Markdown

## Summary

Adds realtime Huawei Scale 3 support through the existing Hagrid WSP handler.

The implementation includes:

  • Huawei Hagrid WSP authentication using user-supplied CAK/C1/C2 credentials
  • Profile synchronization
  • Realtime weight measurements
  • Huawei Scale 3 body composition calculation
  • Body fat
  • Water
  • Muscle
  • Lean body mass
  • Bone mass
  • Visceral fat
  • BMR
  • Protein
  • Impedance
  • Heart rate when available
  • Multiple measurements within the same BLE connection
  • Immediate publishing of completed realtime measurements
  • Correct handling of incomplete body-composition measurements without carrying over stale values from the previous measurement

Measurement behavior

Huawei Scale 3 reports different measurement stages independently.

The implementation therefore supports:

  • weight-only measurements when the user steps off before impedance measurement completes
  • body-composition measurements without heart rate when impedance completes but heart-rate measurement does not
  • full measurements when all stages complete

Realtime measurements are published immediately when received. The scale measurement-status response is then used to complete the hardware measurement cycle and re-arm the same BLE connection for another measurement.

Body composition

Huawei Scale 3 body-composition values are calculated from the low-frequency impedance measurement together with the user profile.

The calculation is implemented directly in Kotlin and does not depend on Huawei native libraries.

Huawei Hagrid credentials

The Hagrid protocol requires three authentication values: CAK, C1 and C2.

These credentials are intentionally not included or hardcoded in this contribution.

I currently do not have enough evidence to determine whether these values are device-specific, model-specific, or shared between Huawei Scale 3 devices. For that reason, credentials obtained from my own Huawei setup are not being published.

openScale therefore allows the user to provide these values locally.

Obtaining the credentials

A short outline of the process used during development is:

  1. Pair and configure the Huawei Scale 3 with Huawei Health normally.
  2. Capture/debug the Hagrid communication or inspect the Huawei Health installation while the scale is configured.
  3. Locate the three Hagrid authentication values:
    • CAK
    • C1
    • C2
  4. Enter those values in the Huawei Hagrid settings in openScale.
  5. openScale then uses them locally for Hagrid WSP authentication.

The credentials should not be posted in public logs or bug reports.

More detailed extraction documentation can be added separately if this implementation is accepted.

Tests

Added and updated tests for:

  • Huawei Scale 3 Hagrid WSP behavior
  • realtime measurement publishing
  • Scale 3-specific gender handling
  • multi-cycle measurement behavior
  • Huawei Scale 3 body-composition calculations
  • incomplete BIA measurements
  • prevention of stale body-composition and heart-rate value inheritance

The focused unit tests pass successfully, and the implementation was also tested with a physical Huawei Scale 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant