Skip to content

Adds support for AnD UC352BLE - #1505

Merged
oliexdev merged 6 commits into
oliexdev:masterfrom
mrblowntobits:feat/add-AnD-UC352BLE-handler
Sep 5, 2026
Merged

oliexdev merged 6 commits into
oliexdev:masterfrom
mrblowntobits:feat/add-AnD-UC352BLE-handler

Conversation

@mrblowntobits

Copy link
Copy Markdown
Contributor

What works:

  • historical data import

Traffic:
btsnoop_hci.log

@oliexdev
oliexdev merged commit accbf81 into oliexdev:master Sep 5, 2026
@oliexdev

oliexdev commented Sep 5, 2026

Copy link
Copy Markdown
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
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.

2 participants