Skip to content

chore: meege upstream branch - #2

Open
AlphaKR93 wants to merge 139 commits into
MadeByAlpha:mainfrom
oliexdev:master
Open

AlphaKR93 wants to merge 139 commits into
MadeByAlpha:mainfrom
oliexdev:master

Conversation

@AlphaKR93

Copy link
Copy Markdown
Member

No description provided.

oliexdev and others added 30 commits July 18, 2026 08:49
* Translated using Weblate (Japanese)

Currently translated at 97.2% (779 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/ja/

* Translated using Weblate (Spanish)

Currently translated at 100.0% (801 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/es/

* Translated using Weblate (Russian)

Currently translated at 92.1% (738 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/ru/

* Translated using Weblate (German)

Currently translated at 100.0% (801 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/de/

* Added translation using Weblate (Catalan)

* Translated using Weblate (Swedish)

Currently translated at 88.7% (711 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/sv/

* Translated using Weblate (Catalan)

Currently translated at 8.8% (71 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/ca/

* Translated using Weblate (Swedish)

Currently translated at 89.1% (714 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/sv/

* Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (801 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/pt_BR/

* Translated using Weblate (Bulgarian)

Currently translated at 100.0% (801 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/bg/

* Translated using Weblate (French)

Currently translated at 87.6% (702 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/fr/

* Translated using Weblate (Bulgarian)

Currently translated at 100.0% (801 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/bg/

* Translated using Weblate (Swedish)

Currently translated at 93.0% (745 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/sv/

* Translated using Weblate (Swedish)

Currently translated at 96.0% (769 of 801 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/sv/

---------

Co-authored-by: apemay <apemay.dev@gmail.com>
Co-authored-by: Isaac Clark <pkv.ko@yandex.ru>
Co-authored-by: Holger Eisold <github@eisold.family>
Co-authored-by: Eduard Ereza Martínez <eduard@ereza.cat>
Co-authored-by: Joel A <joeax910@student.liu.se>
Co-authored-by: Luan M. D. Lima <weblate.capitol237@slmail.me>
Co-authored-by: Viktoria PETROVA <victoriaapetrova@gmail.com>
Co-authored-by: François Kabiry <francoiskabiry@yahoo.fr>
Added values-hi/strings.xml to provide full Hindi localization support.
* Add support for Yunmai X (YMBS-M268) broadcast-only scale

The Yunmai X (YMBS-M268) advertises measurements as manufacturer-specific
data without a local name and needs no GATT connection (the vendor app
calls this device family "YUNMAI-ADV"). Frames echo the device MAC
byte-reversed, carry a 0B 74 17 signature, a state byte (live/stable/
final), weight and impedance as u16 BE, and an XOR checksum.

Identification uses the frame structure + MAC echo during scans and the
advertised 16-bit service UUID 0x1320 for saved-device snapshots (the
scale advertises no name to match on). Body composition is derived from
weight + impedance via YunmaiLib, like the Yunmai SE/Mini handler.

Protocol reverse-engineered from an advertisement capture and confirmed
end-to-end against a live measurement driven through this handler (weight
and full body composition derived and stored). Unit-test fixtures are
synthetic frames built to the observed layout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Show handler name for saved scales that advertise no name

Broadcast-only scales such as the Yunmai X advertise no local name, so the
saved-scale panel rendered a blank line above the MAC. Fall back to the
resolved handler display name when the advertised name is blank.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Added scale support for EEBBL scale.

* Remove "DEBUG" from supported device names in EEBBLHandler

---------

Co-authored-by: oliexdev <olie.xdev@googlemail.com>
The Vitafit "Body Fat" scale (VT701, Vitafit/Fitdays app) speaks a custom
GATT protocol on service 0xFFF0 that no existing handler covers. The protocol
was reverse-engineered from an HCI snoop of a Vitafit-app weigh-in and confirmed
against the scale's displayed readings (85.00 kg / 393 Ohm, 84.95 kg / 389 Ohm).

Frames are [hdr][len][0x26][type][data][chk][0xAA] with an XOR checksum. The
handler streams live weight (type 0x10, stable at flag 0x02, u16 BE in 0.01 kg),
acks the stable weight to trigger the impedance measurement, reads the whole-body
impedance (type 0x11, u16 BE Ohm), and derives body composition via the shared
StandardImpedanceLib. A 6-second fallback publishes weight-only if no impedance
frame arrives.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: OliE <olie.xdev@googlemail.com>
* Add minimal Huawei Hagrid WSP support

* moved HuaweiHagridSecretProvider into HuaweiHagridWspLib.kt

---------

Co-authored-by: shisoratsu <277485761+shisoratsu@users.noreply.github.com>
Co-authored-by: oliexdev <olie.xdev@googlemail.com>
- Allow external apps to enrich existing measurement entries with any metric (including custom types) via the `values_json` payload.
- Skip types already handled by explicit columns to prevent redundant updates.
- Add `GenericValueJsonTest` to verify round-trip parsing of numeric values across predefined and custom types.
Commit cd4d5e1 ("Fix: Use UTC for MiScale time synchronization")
switched both the write of the BLE Current Time characteristic and the
parsing of time read back from the scale from the device's default
(local) timezone to hardcoded UTC. The scale itself has no timezone
concept: it only ever receives and echoes back plain wall-clock digits
(year/month/day/hour/minute/second), with no UTC/local distinction. It
expects those digits to represent local wall-clock time.

Sending it UTC digits instead - while still interpreting whatever it
reports back as UTC - produces a timestamp permanently offset from the
true measurement time by the device's local UTC offset (e.g. +2h during
CEST, +1h during CET), since the round-trip no longer matches the
convention the firmware itself assumes.

This was found by cross-referencing years of MIBFS (Xiaomi Mi Body
Composition Scale) measurements recorded by openScale against an
independent BLE reader of the same physical scale: every measurement
from before cd4d5e1 matches ground truth exactly; every measurement
since is offset by exactly the local UTC delta at the time of
measurement. No linked issue or repro was found for cd4d5e1's stated
rationale ("previously the device's local timezone was used, which
could lead to incorrect timestamps"), and it is contradicted by this
data.

This reverts the two timezone-related lines to their pre-cd4d5e16
behavior (local timezone for both write and parse), while keeping the
unrelated day-of-week/adjust-reason payload byte correction from the
same commit, which is a separate, valid protocol fix.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
eLink/Icomon "MGB"-family scale on service 0xFFB0. Reads weight plus body fat, water, lean mass, bone, protein and visceral fat from the scale's data dump, with time/user/unit sync. Registered ahead of MGBHandler so its FitTrack name match wins the shared 0xFFB0 service. Includes unit tests for the frame decode.
)

* Add selectable Scientific body-composition algorithm to Mi Scale

Mi Scale v1/v2 previously derived body composition only from the
reverse-engineered Mi Fit algorithm (MiScaleLib). This adds a per-scale
setting letting users pick between that "Xiaomi (original app)" path and
a new "Scientific" estimator.

- BodyMiScaleLib: mono-frequency estimator ported from the bodymiscale
  Home Assistant integration (GPL-3.0). SCIENCE mode chains a
  hardware-calibrated LBM with peer-reviewed formulas (Siri, Pace, Wang,
  Schofield) and additionally reports protein and BMR. Locked to
  byte-for-byte parity with the reference project via a regression test.
- MiScaleHandler: radio picker to choose the algorithm; new measurements
  use the selected path.
- ScaleDeviceHandler: extract a reusable SettingRadioGroup composable
  (settings-backed radio group) for device configuration UIs.
- CREDITS: add bodymiscale attribution.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Kukula <daniel.kuku@gmail.com>

* Simplify BodyMiScaleLib to a scientific-only estimator

The Mode enum threaded through every method was a vestigial artifact of
the upstream bodymiscale port. openScale already selects the algorithm at
the handler (MiScaleLib vs BodyMiScaleLib), so BodyMiScaleLib.Mode.XIAOMI
was never used in production — only by a test comparing it to MiScaleLib.

Drop Mode and its XIAOMI branches so the class is purely the scientific
path. Method signatures shrink accordingly (getProtein no longer needs
muscle/water, which existed only for the Xiaomi formula). Output is
unchanged; the regression fixture still matches byte-for-byte.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update CREDITS

---------

Signed-off-by: Daniel Kukula <daniel.kuku@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: OliE <olie.xdev@googlemail.com>
* Add Runstar R6 scale support

Adds RunstarR6Handler for the Runstar R6, whose FFB0 protocol is
distinct from R5 despite the similar name. Publishes live weight,
heart rate, impedance, and syncs offline-stored history entries.

RunstarR5Handler now excludes "RUNSTAR-R6" explicitly so the two
can't collide; R6 is registered ahead of R5 in ScaleFactory. Also
corrects two stale comments in RobiS9Handler now that the shared
FFB0 checksum and impedance/heart-rate offsets are known.

* Tighten Runstar R5 name matching instead of excluding R6

R5 matched any "RUNSTAR-" prefix, which also caught R6 devices.
Restrict it to the known "RUNSTAR-R5"/"RUNSTAR-RX" names instead of
adding an R6-specific exclusion — removes the need for R6 to be
registered ahead of R5, and the collision no longer needs explaining
in RunstarR6Handler's doc.

Also trims two RobiS9Handler comments down to the new finding
(checksum formula, impedance/heart-rate offsets) without pointing at
RunstarR6Handler for the backstory.

---------

Co-authored-by: Leon Dönch <leon.doench@nelsen.de>
* Add Keep S3 scale support

* Revert addition of extended measurement metrics and database version 16

This change removes support for several recently added measurement types and reverts the database schema to version 15.

Key changes include:
*   **Measurement Types:** Removed `PHASE_ANGLE`, `SKELETAL_MUSCLE`, `LEAN_SOFT_TISSUE`, `SUBCUTANEOUS_FAT`, `BODY_AGE`, `BMI_22_REFERENCE_WEIGHT`, and `DEVICE_IMPEDANCE` from `MeasurementTypeKey` and `ScaleMeasurement`.
*   **Database:** Reverted `AppDatabase` version to 15, deleted `MIGRATION_15_16`, and removed the version 16 JSON schema.
*   **Units & Strings:** Removed `UnitType.DEGREE` and associated string resources and localization logic.
*   **Logic Cleanup:**
    *   Removed generalized percentage-to-mass unit conversion logic in `ConverterUtils` and `MeasurementTypeCrudUseCases`.
    *   Updated `KeepS3Handler` to stop publishing extended metrics.
    *   Removed `awaitPendingOperations` from the BLE transport interface.

* Add muscle percentage mapping in KeepS3Handler

* Fix Keep S3 runtime behavior

---------

Co-authored-by: oliexdev <olie.xdev@googlemail.com>
Shares service 0xFFB0 and the 20-byte frame family with RobiS9Handler and
RunstarR6Handler, but differs in two ways.

Frames fragment: byte 2 is a fragment index, not a constant zero, and the
0xA3 result spans two frames. Every fragment contributes bytes[3..18], so
the byte after the fragment index is payload rather than a header byte to
skip. Both existing handlers in this family reject such frames outright.

The 0xBA profile is generated rather than replayed. RobiS9Handler replays
a captured handshake because its timestamp and token could not be
regenerated; this one is understood field by field, so it is built from
the openScale user. flags1 carries sex and age and is the only place they
are sent -- getting it wrong is silent, the scale simply computes for the
wrong person. The generated frame is byte-identical to a capture the scale
accepts.

Body composition comes from Wla25BodyComposition, ported from
ICBodyFatAlgorithmWLA25::calc in the vendor library: fat mass is a 13-term
linear regression over height, weight, the rounded BMI and all ten
impedances, and the rest follows from fat-free mass. Verified against the
vendor library over 240 randomised inputs spanning both clamp boundaries,
both impedance branches and both sexes -- exact on all ten fields.

Three roundings are load-bearing and each is worth a tenth of a unit: the
weight is rounded before anything else, the BMI fed into the regression is
rounded, and fat mass is rounded before fat-free mass is derived from it.
The rounding is half-up and computed in float32; everything else runs in
double, matching the library. Doing it all in Float shifts BMR by 1 kcal
in roughly one case in eighty.

compute() takes no sex parameter: this algorithm's body composition does
not depend on it, only metabolic age does.

Known limitation: bone mass can read 0.1 kg below the scale's own display.
The vendor app agrees with this code, and no algorithm the vendor library
ships reproduces the scale's combination of values, so the scale's
firmware appears to compute bone differently.

Metabolic age is implemented but not published -- ScaleMeasurement has no
field for it. EtekcityLib and HesleyHandler hit the same wall, one
computing it and the other reading it off the wire, both discarding it.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Support 8-byte streaming frames in MGBHandler (Dr Trust Smart 505)

MGBHandler previously assumed every notification was a 20-byte
composite frame and dropped anything else, so scales like the Dr
Trust Smart 505 (same SWAN name / 0xFFB0 service, but 8-byte
streaming frames) connected and never produced a measurement.

onNotification now dispatches on frame size: the existing 20-byte
composite path is unchanged (only moved into onCompositeFrame), and
a new 8-byte streaming path parses live/final weight and impedance
frames via pure, unit-tested companion functions, latching both
values before publishing one measurement and deriving body
composition with StandardImpedanceLib (same approach as
VitafitVT701Handler).

* Inline onStreamingFrame into onNotification

It had a single call site; folding it into the 8-byte branch matches
VitafitVT701Handler's flatter onNotification style. No logic change.

---------

Co-authored-by: Claude <noreply@anthropic.com>
* Add Keep S3 scale support

* Revert addition of extended measurement metrics and database version 16

This change removes support for several recently added measurement types and reverts the database schema to version 15.

Key changes include:
*   **Measurement Types:** Removed `PHASE_ANGLE`, `SKELETAL_MUSCLE`, `LEAN_SOFT_TISSUE`, `SUBCUTANEOUS_FAT`, `BODY_AGE`, `BMI_22_REFERENCE_WEIGHT`, and `DEVICE_IMPEDANCE` from `MeasurementTypeKey` and `ScaleMeasurement`.
*   **Database:** Reverted `AppDatabase` version to 15, deleted `MIGRATION_15_16`, and removed the version 16 JSON schema.
*   **Units & Strings:** Removed `UnitType.DEGREE` and associated string resources and localization logic.
*   **Logic Cleanup:**
    *   Removed generalized percentage-to-mass unit conversion logic in `ConverterUtils` and `MeasurementTypeCrudUseCases`.
    *   Updated `KeepS3Handler` to stop publishing extended metrics.
    *   Removed `awaitPendingOperations` from the BLE transport interface.

* Add muscle percentage mapping in KeepS3Handler

* Fix Keep S3 runtime behavior

* Complete Traditional Chinese translation

---------

Co-authored-by: oliexdev <olie.xdev@googlemail.com>
- Switched to `ExistingPeriodicWorkPolicy.UPDATE` to prevent backup postponement on reboots or settings changes
- Added tracking and display for the next scheduled backup time in settings
- Added detailed error reporting and specific failure states (location inaccessible, file creation, or write failures)
- Removed flex interval from `PeriodicWorkRequest` to ensure more regular scheduling
- Improved folder picker behavior by launching at the currently configured location
- Added unit tests for backup error state persistence
* Added a "package" extra in `startSyncService()`, so all five triggers carry it and a future one cannot forget it.
  Scales only report what they can weigh, so waist, hips, caliper and
  custom values were absent on every Bluetooth sync. applyValueInheritance
  fills those gaps from the last measurement *before* the incoming
  timestamp, so historic entries read from a scale's memory inherit the
  state of their own point in time, never of a later one.

  Only numeric (FLOAT/INT) values are inherited; empty, derived, internal
  and disabled types are skipped. Values the scale delivered always win.
  The add-measurement form now pre-fills through the same method, so a
  manual entry starts out exactly where a sync would.
  Aggregated entries are synthetic and all carry Measurement.id == -1,
  so the LazyColumn key must not fall back to the id. It did whenever
  isAggregated was false while the list already held aggregated items —
  that flag comes from the settings flow, the items from the data flow,
  and the two disagree for a frame after an aggregation change or on the
  first composition, where the cached data flow already has the previous
  result. Every row then got the key -1 and Compose aborted the measure
  pass with "Key -1 was already used".

  Key by id + timestamp instead: unique for raw rows via the database id,
  unique for aggregated rows because their periods are disjoint.
* Complete the Turkish translation (154 -> 782 of 811 strings)

Turkish was the least complete of the maintained locales at 19%, while
German and Spanish sit at 95%. Four out of five strings a Turkish user
saw were still English, which makes large parts of the app - Bluetooth
setup, insights, backup and every error message - unreadable for users
who do not speak English.

This adds the 628 missing translatable strings. Existing translations
are untouched, and their terminology is followed for consistency.
Strings marked translatable=false are left out.

Verified: gradlew :app:processDebugResources completes successfully;
format specifiers match the source strings one for one.

* Reword three Turkish strings that read awkwardly in context

Found while walking the app on an emulator with the Turkish locale
active - these were literal renderings that a native speaker would not
say out loud.

- permission prompt: 'erişimine gereksinimimiz var' -> 'erişimi
  gerekiyor'
- generic confirm: the verb placeholder no longer has to fit a Turkish
  case ending, which it cannot do for an arbitrary verb
- unit-change dialog: 'sürdürmek' -> 'devam etmek'

* Shorten the plateau chip so it fits on screen in Turkish

The insight chips sit in a horizontally scrolling Row, and my
translation of the plateau chip was long enough that it was clipped at
the screen edge on a 1080px-wide device: it rendered as '180 gunluk
durag'. The English 'plateau %1$d days' fits, so this was the
translation's problem, not the layout's.

'%1$d gunluk duraganlik' -> '%1$d gun duragan', which is shorter than
the English source and reads just as naturally.

Verified on an Android 16 emulator with the app locale set to Turkish:
the chip now renders in full as '180 gun duragan'.
Every other file in core/bluetooth/libs has a matching test - 17 libs,
16 tests. This adds the one that was missing.

The class documents three rounding steps as load-bearing and pins the
rounding mode with two exact values; both are asserted here through
compute(), since round1 is private and rounds the incoming weight
before anything else. The validity gate's asymmetry - slots 0 and 5
checked against 1.0, the other eight against 100.0 - is covered per
slot, because that asymmetry is what fixes the ordering of the ten
impedances.

The remaining assertions are on invariants the source states outright
(the 3-60% fat clamp, visceral fat 1-20, fat-free mass as weight minus
fat, BMR from Katch-McArdle), so they hold independently of the
regression constants and cannot go stale if those are ever retuned.
jorge-lavin and others added 30 commits October 24, 2026 12:03
* feat: add Body Pod 2 support

* fix(body-pod-2): address review feedback

* fix(body-pod-2): store whole-body impedance in the built-in types

  Store the whole-body impedance of the high frequency in IMPEDANCE and of
  the low frequency in IMPEDANCE_LOW, as KeepS3Handler does, instead of ten
  per-segment types. Previously the low-frequency value ended up in
  IMPEDANCE ("Impedance (high)"). Drop the segment types, deviceOhm and
  their strings.

  Publish the weight when the impedance is implausible instead of dropping
  the whole weigh-in; only the out-of-range value is left out.

  Rebuild the test frames from the barefoot weigh-in posted in the PR so
  low and high frequency differ as on the real scale.

---------

Co-authored-by: oliexdev <olie.xdev@googlemail.com>
  BluetoothFacade built its own ScaleUser without activity level, goal and
  initial weight or the weight unit. GATT and broadcast adapters ignored it
  in favour of their mapUser() snapshot, but the SPP adapter passed it to
  onConnected(). Adapters now always use their own snapshot, and
  BleConnector only needs the selected user's id.

  Also drop the legacy-handler user check, which no handler name matches,
  log when mapUser() fails instead of silently keeping the defaults, and
  keep the user connect() maps itself as the snapshot, so the GATT and
  broadcast callbacks no longer drop the session when it isn't there yet.
* fix(bluetooth): decode the short live frame sent by PICOOC-CC

The PICOOC-CC sends a 10-byte 0x39 frame (timestamp, weight, impedance)
instead of the 16-byte one, so parseLiveFrame rejected it and no
measurement was ever stored. Recognise it by its length byte and treat it
as a settled reading.

* test(bluetooth): cover PICOOC-S3 short frames and list CC/S3 in the catalog

The PICOOC-S3 uses the same 10-byte live frame as the CC. Add its captured
frames (barefoot and with socks, where impedance is 0 and only the weight is
stored) and give both models their own row in the scale catalog.

* Update ScaleCatalog.kt

---------

Co-authored-by: OliE <olie.xdev@googlemail.com>
…WHSCL1) (#1569)

  feat: add iHealth HS2S / HS2S Pro and Wyze Scale (WHSCL1) support (#1569)

  Closes #853
  feat: add Chipsea-BLE GATT body fat scale support (#1571)
* feat(bluetooth): support the Urikar Aero I in TaylorBIAHandler
The Lescale F4P (ICOMON model FI2019LB-C, firmware 1.0.3) speaks the
Runstar R6 protocol on service 0xFFB0, next to the Nordic DFU service
0x1530. RunstarR6Handler now claims it by its advertised name, "Lescale
F4P". Verified against six weigh-ins captured with a BlueZ script, then
an end-to-end weigh-in with a debug build on a Pixel (Android 13):
74.3 kg, 78 bpm and 492 ohm decoded and saved with body composition.

Two differences from the R6, both seen in every capture:

- The top three bits of the trailer byte are flags, not part of the
  checksum. 0x20 is set on every frame while the scale displays pounds.
  isChecksumValid() now compares the low five bits only; the other
  scales in this family leave the top bits clear. The flag in frames
  the app sends sets the display unit: a 0xBA user frame without it
  switched the scale from pounds to kg. Frames to the F4P therefore
  carry the user's unit (0x20 for LB; KG and the untested ST send 0).
- Like the HO-36, the F4P gets the 0xBA user frame right after the 0xA1
  ack. It answers 0xA0 01, shows body composition on its display, and
  after the weight locks (A2 state 0x04, about 20 s) reports impedance
  and heart rate in 0xA3. The existing encodeHoffenUserInfo() payload
  is accepted as-is.

Known limitation: ScaleUser.scaleUnit is never filled in from the
user's weight unit (BluetoothFacade.toScaleUser()), so handlers always
see KG and the F4P is switched to kg. Measurements are stored correctly
either way; the scale's own display shows kg.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…1583)

The IFIT (vendor app "Unique Health", a Lefu OEM weight-only broadcast
scale) advertises the same manufacturer-data frame as the Sinocare
"Weight Scale": company id 0x0000, the advertiser address, the signature
CE 01 02, the weight little-endian in 0.01 kg and an XOR check byte.
Claim it by name with its own display name so it gets its own catalog
row, and cover the handler with verbatim frames from a BTSnoop capture
of one weigh-in: settling, locked, end-of-measurement and idle frames,
plus the same 5.3 kg object in kg and in lb mode, where the weight
stays in kilograms and only the display-unit byte changes.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
The M1827CH variant (好轻 mini 2S, model M1501) advertises Yunmai X
measurement frames with signature 06 52 11 instead of 0B 74 17. All other
fields are identical, but YunmaiXAdv rejected every frame, so the scale was
detected yet no measurement was saved. The scale is broadcast-only, so a GATT
connection cannot be used as a workaround.

Accept both signatures and add tests for the variant.

Co-authored-by: imconical <13324742+imconical@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Replace the synthetic Chinese M1827CH fixture with a final (state 03)
advertisement captured from an M1827CH with nRF Connect during a
barefoot weigh-in: signature 06 52 11, session 0x7F, 87.65 kg, 354 Ohm,
XOR 0x00.

The MAC-echo bytes (manufacturer id and payload bytes 0..3) are zeroed
and the address is set to all zeroes: those bytes lie outside the
checksum range, and the device address is private.

Follow-up to #1575.

Co-authored-by: imconical <13324742+imconical@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
* fix: restore body composition on VA QN scales

* fix: use real Renpho guest profiles and scale-reported body fat

* fix: preserve Fit Plus impedance and simplify Renpho metadata

* Delete android_app/app/src/main/assets/licenses/renpho-escs20m.txt

---------

Co-authored-by: OliE <olie.xdev@googlemail.com>
* feat(bluetooth): support the Wyze Scale X (WSCALX)
* feat: add Sacoma Ultra

The Sacoma Ultra (8 electrodes + handlebar, Fitdays/Sacoma app) advertises
as "SACOMA SCALE" with 0xFFB0 + 0x1530 and speaks the Runstar R6 / FG2202WB
protocol.

- Claim it in RunstarR6Handler.
- Decode the two-part 0xA3: ten segmental impedances (u16 BE, 0.1 ohm) fed
  to Wla25BodyComposition. Previously bytes 9..10 (the first trunk value)
  were read as a whole-body impedance, giving nonsense body composition.
  Applies to the FG2202WB too, which sends the same frame.
- Send the 0xBA user frame so the scale's display shows body composition.
- Treat status 0x25 as normal for the 8-electrode scales.

Verified on hardware: 14.6 % fat vs Fitdays' 14.0 %, visceral fat, bone and
protein within 0.1; display shows body composition with openScale alone.

* fix: leave BMR and LBM to openScale's derived values

Per the "How to support a new scale" guide: do not compute what openScale
already derives. WLA25 still provides fat, water, muscle, bone, visceral
fat and protein.

* fix: publish skeletal muscle as muscle, plus total muscle and body age

openScale's MUSCLE is skeletal muscle (plausible 15-60 %). WLA25's broad
'muscle rate' (~80 %) goes to the shared total_muscle type, as in
KeepS3Handler, and WLA25's body age to the shared metabolic_age type.
… in one place

  The previous-measurement snapshot was built by mapMeasurement(), a leftover
  from the Java migration that copied seven fixed fields and wrapped the
  stored numbers as Kg/Percent without converting from the unit the user
  configured. Handlers asking lastMeasurementFor() therefore got lb values
  as kg and no impedance at all: the S400 never computed its hydration
  shift, and the Wyze Scale X always sent 0 as the last impedance.

  ScaleMeasurement now owns both directions: toStored() converts the
  values from the wire unit into each type's unit (used by BleConnector),
  fromStored() is its inverse for every predefined key (used for the
  snapshot). mapMeasurement() is gone.

  Supersedes #1591.
…alues in one go

  Derived values (BMI, BMR, TDEE, ...) are now always openScale's own
  calculation: BleConnector drops what a scale reports for them. BMR gets
  a formula setting like body fat, water and LBM (Mifflin-St Jeor by
  default, Katch-McArdle, revised Harris-Benedict). It is calculated in
  MeasurementTransformationUseCase on every save, so it follows edits
  instead of keeping a stale value. DerivedValuesCalculator keeps
  Mifflin-St Jeor only for rows that arrive without a BMR (CSV import,
  ContentProvider).

  A new measurement is inserted together with its values in one
  transaction, followed by a single recalculation. Before, every value
  insert triggered its own recalculation, which could create a second
  BMR row and needed BMR to be sorted first in BleConnector.

  Editing a measurement no longer duplicates formula values: a value
  without an id now replaces the stored row of its type instead of adding
  a second one. This affected body fat, water and LBM with an active
  formula.
  saveMeasurementFromBleDevice() ignored the result of saving, so the
  connector announced "measurement saved" even when the save failed, the
  timestamp was already taken, or smart user assignment dropped the reading
  for lying outside every user's tolerance. It now returns whether a new
  measurement was stored, logs duplicates and dropped readings, and lets a
  failed save through to the connector's error message.
* Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (940 of 940 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/pt_BR/

* Added translation using Weblate (Hungarian)

* Translated using Weblate (Hungarian)

Currently translated at 5.7% (54 of 940 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/hu/

* Translated using Weblate (Hungarian)

Currently translated at 100.0% (940 of 940 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/hu/

* Translated using Weblate (French)

Currently translated at 90.8% (854 of 940 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/fr/

* Translated using Weblate (Spanish)

Currently translated at 99.7% (938 of 940 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/es/

* Translated using Weblate (English)

Currently translated at 100.0% (941 of 941 strings)

Translation: openScale/Strings
Translate-URL: https://hosted.weblate.org/projects/openscale/strings/en/

---------

Co-authored-by: Tiago Rinaldi <trinaldi@users.noreply.hosted.weblate.org>
Co-authored-by: Hevesi János <hj@users.noreply.hosted.weblate.org>
Co-authored-by: Acide-Burn <acide-burn@users.noreply.hosted.weblate.org>
Co-authored-by: Enrique Condes <kosme@users.noreply.hosted.weblate.org>
Co-authored-by: finng99hh <finng99hh@users.noreply.hosted.weblate.org>
  On startup the type filter could run before the measurement types had
  been loaded. With an empty list it stored an empty selection, which wiped
  the user's choice (graph gone) and, once the types arrived, fell back to
  the default of weight and body fat. An empty type list no longer
  overwrites the saved selection. Affects every type filter: overview,
  graph, insights and table.

  Fixes #1602
…bytes

  The scale answers a history request with 0x01, the record count and the
  echo of the request's bytes 1..4. Current firmware sends a 16-bit count
  (7 bytes, e.g. 01 43 00 FF FF 00 01 for 01 FF FF 00 01); the original v1
  documented a single count byte (6 bytes). The marker was always read
  from bytes 2..3, so on current firmware the reply to "only last" was
  taken for a control response and ignored, on v1 and v2. The fallback
  then requested the scale's whole history (e.g. 115 records instead of 1
  new one, #1431) on every connection, and on the weight-only Mi Smart
  Scale 2 (XMTZC04HM, v1 since #1490) the transfer stopped after the first
  packet. Both reply lengths are now parsed.

  Refs #1596
- Drop observeAppLanguageCode, setAppLanguageCode and resolveDefaultAppLanguage from UserFacade and UserUseCases
- Remove the hardcoded supported-language set and its system-locale fallback
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.