Skip to content

bug(bee): voltage-format battery replies are interpreted as percentages #21749

Description

@jms830

Product impact

Primary loop layer: UX-Polish — incorrect Bee battery/charging information undermines trust in capture readiness. No claim of data loss from this parser defect.

Bug and reproduction

The mobile Bee connector assumes every C00F battery payload is [percentage, charging]. A Bee tested with cached firmware 0.6.20 instead returned:

Full control response: 00 80 0f c0 db 0f 00
C00F payload:          db 0f 00

Passing this payload to BeeDeviceConnection.parseBatteryResponse on current main (657a94bbbbc2fd157396aa05594fb5d596a1df77) gives:

{'level': 219, 'is_charging': true}

The three-byte format is little-endian millivolts plus a charging-state byte: 0x0fdb = 4059 mV, state 0 = not charging. The voltage byte is not a percentage. This also explains misleading low readings when the low byte happens to fall between 0 and 100; clamping the current result is not a fix.

Expected behavior

Decode the voltage-format response and derive a percentage estimate using the matching calibration; retain the older two-byte percentage format. Read voltage-format charging from byte 2 (state 1 means charging). Reject unsupported lengths/implausible voltage readings instead of displaying their low byte as charge.

The Bee Frontier voltage curve maps this sample to about 76%. This is a calibration estimate, not an independently measured remaining capacity, and hardware-generation applicability beyond this device needs confirmation.

Environment and evidence limits

  • Android; Omi 1.0.558 / build 1400.
  • Cached Bee firmware 0.6.20; cached generic model/hardware labels do not independently identify a hardware generation.
  • The raw response was captured on a patched/rooted Android connection path, not reproduced using an unmodified stock connection. The exact payload can nevertheless exercise the current upstream parser without BLE, authentication or audio.
  • A local compatibility patch produced a subsequent 77% UI reading, preserved checked recording settings and resumed audio forwarding. That later reading is not the identical instantaneous 4059 mV sample, nor proof of an upstream Flutter build.
  • No user/account identifiers, audio, transcripts, APKs or proprietary disassembly are attached. Account access is unnecessary for the parser reproduction.

Prior art and proposed scope

Refreshed issue/PR searches on October 15 found no matching voltage-format fix; current mobile source still has the two-byte assumption.

Activity

  1. moved this from Someday to In progress in omi TODO / bountieson Oct 15, 2026
  2. hardik4love-lang commented on Oct 15, 2026

    @hardik4love-lang
    Contributor

    Opened PR #21768 addressing this:

    • Format Detection: Distinguishes legacy 2-byte percentage payloads ([percentage, charging]) from newer 3-byte millivolts payloads ([mv_low, mv_high, charging_state]).
    • Plausibility Guard: Rejects unsupported or corrupted readings outside the 3000 mV – 4500 mV LiPo window by returning null.
    • Calibration Mapping: Converts millivolts to percentage using the standard LiPo discharge and charging state curves (mapping sample 0x0fdb = 4059 mV to 77% when discharging).
    • Hermetic Unit Tests: Added app/test/unit/bee_connection_battery_test.dart verifying all branches, the 4059 mV sample, boundaries, and out-of-range rejection.
  3. moved this from In progress to In review in omi TODO / bountieson Oct 16, 2026
  4. hardik4love-lang commented on Oct 16, 2026

    @hardik4love-lang
    Contributor

    This issue is now resolved in PR #21768 (merged by @kodjima33 into main):

    • Payload Format Detection: Differentiates 2-byte percentage legacy responses from 3-byte millivolt responses with Little Endian parsing.
    • LiPo Voltage Curves: Correctly converts millivolts to percentage across charging and discharging states with monotonic calibration tables.
    • Plausibility Gate: Clamps legacy percentage (0–100%) and rejects invalid hardware millivolt readings outside 3000–4500 mV.
    • Hermetic Unit Tests: All tests passing in �pp/test/unit/bee_connection_battery_test.dart.

    Bounty Claim Details

    @kodjima33 @josancamon19

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions