Repository navigation
Adds support for AnD UC352BLE - #1505
Merged
oliexdev merged 6 commits intoSep 5, 2026
Merged
Conversation
Owner
|
Thanks for your PR |
KristianP26
added a commit
to KristianP26/ble-scale-sync
that referenced
this pull request
Oct 13, 2026
In multi-char mode the handler enables every notify binding before it calls onConnected. A SIG Weight Scale such as the A&D UC-352BLE is told the time first and only then has its indications enabled: the vendor app does it in that order in all three connections of the public capture in oliexdev/openScale#1505, and the manufacturer's sample app and an independent driver do the same. What the scale does in the other order is unknown. A binding marked deferred is now left to the adapter, which enables it from onConnected with ctx.subscribe. The handler's "Step on the scale" prompt is skipped for such an adapter, since nothing the weigh-in arrives on is enabled yet. registry-check refuses a deferred binding on an adapter without onConnected, and on anything but a notify binding. A bonded peer keeps its CCCD across connections, and our unsubscribe only drops the listener. Left on, the scale could indicate at the start of the next connection, before the time write and before anything listens, and BlueZ confirms every indication by itself, so that weigh-in would be lost. The vendor app turns indications off before the scale disconnects. On node-ble a successful session therefore turns a deferred binding off with StopNotify and waits 500 ms for BlueZ to write the CCCD before it disconnects. A shutdown skips this or cuts the wait short, and a cycle the poll loop has replaced meanwhile leaves the link to the newer one. No adapter declares a deferred binding yet, so nothing changes for any existing scale: same subscribe order, same log lines, and no D-Bus call, wait or extra await before the disconnect. Refs #408
KristianP26
added a commit
to KristianP26/ble-scale-sync
that referenced
this pull request
Oct 13, 2026
The UC-352BLE is a plain Bluetooth SIG Weight Scale, but today nothing reads it reliably. node-ble auto-discovery never picks it, and with ble.scale_mac the generic catch-all claims it on 0x181D, writes no time and hides a refused CCCD at debug level. The public capture in oliexdev/openScale#1505 shows what the scale needs: it asks for a bonded link in every connection, the app writes the local time as a 7-byte Date Time to 0x2A08 (the scale has no Current Time Service), then enables indications, and each weigh-in arrives stamped with the time just written. The capture has no GATT discovery, but every handle it touches matches the discovery dump in HEADS-project/ThingML-BLE. The adapter claims the scale by its name prefix only, so every other WSS scale stays with the catch-all, and does the app's sequence through a deferred notify binding. A refused write or indication fails the session with pairing instructions. Weight only; the scale's time stamp goes into the reading, a stored record keeps its own and goes out as history, and a 4 s hold lets the later of two live records win. Priority 225 keeps it under Renpho ES-WBE28, which the mqtt-proxy notify-char fallback must keep picking for nameless WSS devices; a registry-check invariant enforces that. The scale keeps a single bond, and on BlueZ connecting to it can be enough for the kernel to pair it, which would unpair the A&D app. A new singleBond flag therefore keeps node-ble auto-discovery off it, so only ble.scale_mac selects it, and npm run scan says so instead of promising auto-discovery. For such an adapter alone ensureBonded may take the BlueZ default-agent role without a PIN while the scale is not paired yet (a fallback for BlueZ before 5.51; from 5.51 on BlueZ makes our agent the default by itself), and warns once when BlueZ paired without storing a bond. Every other adapter calls ensureBonded with the same three arguments as before, so their D-Bus traffic and logs do not change; only the adapter lists in logs and the published counts grow. Not confirmed on hardware yet, and documented as such. Refs #408
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.
What works:
Traffic:
btsnoop_hci.log