Repository navigation
Merged
Conversation
The handler was attempting to decrypt measurement data with AES-CTR, but the actual protocol only uses XOR obfuscation. This caused body composition metrics (fat%, impedance) to not be parsed correctly. Changes: - Remove incorrect AES decryption from measurement data parsing - Enable BODY_COMPOSITION device capability - Parse weight from position 1 using formula: (1457 - byte[1]) / 10 - Parse body fat % from position 20 (whole percent) - Parse impedance from positions 2-3 (big-endian, ohms) - Parse user ID from position 31 - Add u16be() helper for big-endian 16-bit reads The scale now correctly reports weight, body fat percentage, and impedance values matching what the Huawei Health app displays. Note: Timestamp position not yet identified, using current time. Additional metrics (visceral fat, skeletal muscle) may be present in remaining bytes but positions not yet reverse engineered. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Extended the Huawei AH100 measurement parsing to include additional body composition metrics identified through BLE sniffing and reverse engineering: - Position 10: Visceral fat rating - Position 20: Skeletal muscle % (previously mislabeled as body fat %) - Position 27: Body water % Note: Position 20 was initially thought to be body fat %, but BLE capture analysis revealed it's actually skeletal muscle percentage. The actual body fat % position is still unidentified - the Huawei Health app shows different values (e.g., 34.7% fat vs 45% skeletal muscle) which suggests additional calculation or a different data position. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Changed position 20 from skeletal muscle to body fat percentage based on user testing. The scale displays 45% fat when connected to openScale. Note: Position 20 appears to show different values depending on the connected app - Huawei Health shows it as skeletal muscle %, while openScale shows it as body fat %. The scale likely calculates metrics differently based on user profile data sent by each app. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Removed visceral fat from the parsed metrics as the transmitted values don't match what the scale displays (e.g., app shows 3 but scale shows 4). Final parsed metrics: - Weight (position 1) - Body fat % (position 20) - Body water % (position 27) - Impedance (positions 2-3) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This was referenced Dec 26, 2025
Owner
|
Thanks for your PR |
This was referenced Jan 5, 2026
syyyr
added a commit
to syyyr/openScale
that referenced
this pull request
Apr 7, 2026
This commit completely breaks the AH100 scale, possibly because it assumes it is the same as the CH100 scale. This reverts commit 2e7e708.
syyyr
added a commit
to syyyr/openScale
that referenced
this pull request
Apr 10, 2026
This commit completely breaks the AH100 scale, possibly because it assumes it is the same as the CH100 scale. This reverts commit 2e7e708.
syyyr
added a commit
to syyyr/openScale
that referenced
this pull request
Apr 22, 2026
This commit completely breaks the AH100 scale, possibly because it assumes it is the same as the CH100 scale. This reverts commit 2e7e708.
syyyr
added a commit
to syyyr/openScale
that referenced
this pull request
May 5, 2026
This commit completely breaks the AH100 scale, possibly because it assumes it is the same as the CH100 scale. This reverts commit 2e7e708.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Huawei AH100 body composition parsing
Summary
This PR fixes the Huawei AH100 (CH100) Bluetooth scale handler to properly parse body composition metrics (body fat %, body water %, and impedance) in addition to weight. Previously, the handler only showed weight measurements.
Problem
The original implementation attempted to parse measurement data after AES-CTR decryption, but the scale actually transmits data that is XOR-obfuscated only (using device MAC address), not AES encrypted. This caused all body composition values to be incorrect or missing.
Solution
Through reverse engineering with BLE packet captures, I discovered the correct data format:
Measurement Data Format
The scale sends measurements as two 16-byte frames (opcodes
0x0Eand0x8E) that are merged into a 32-byte buffer. This data is XOR-obfuscated with the device MAC address but NOT AES encrypted.Byte positions in the XOR'd 32-byte buffer:
weight_kg = (1457 - byte[1]) / 10)Key Changes
handleEncryptedPair()- data is XOR-onlyInteresting Discovery: App-Dependent Calculations
Position 20 shows different values depending on which app is connected:
This suggests the scale performs different calculations based on user profile data sent by each app during the authentication/setup phase.
Testing
Tested with:
Limitations
Timestamp: The exact position of the timestamp in the 32-byte buffer has not been identified. The handler uses the current device time (
Date()) for measurements. This is acceptable for real-time measurements but may affect historical data accuracy.Additional metrics: Other metrics that Huawei Health displays (visceral fat, skeletal muscle mass, bone mineral, protein, etc.) are either:
Initial investigation found visceral fat at position 10, but values were inconsistent with scale display and were removed.
Reverse Engineering Process
The fix was developed through systematic BLE packet analysis:
Files Changed
android_app/app/src/main/java/com/health/openscale/core/bluetooth/scales/HuaweiAH100Handler.ktparseAndPublishMeasurement()with correct parsing (lines 329-371)u16be()helper for big-endian reads (lines 436-437)BODY_COMPOSITIONcapability (line 74)Commit History
85bf57c8- Fix Huawei AH100 body composition parsing (remove AES, fix weight/impedance)70f8fe4e- Add visceral fat, skeletal muscle, and body water parsing9b28fb84- Parse position 20 as body fat percentage2bc88406- Remove visceral fat parsing due to inaccurate valuesRelated Issues
This addresses users who reported that the Huawei AH100 scale only showed weight without body composition metrics when using openScale, while the official Huawei Health app displayed full body composition data.