Commit 53ed2d2
committed
feat(scales): add the Silvergear Smart Scale 108 broadcast adapter
The unit is not connectable. Two iOS PacketLogger captures of complete
weigh-ins contain LE advertising reports and no ATT traffic at all, which
matches the reporter's nRF Connect finding, so a GATT connect was never going
to work: BlueZ discards the Device1 object for a non-connectable peer the
moment discovery stops, which is where the original "Connect doesn't exist"
error came from.
Everything the scale reports is in its manufacturer data, under an invented
company id 0xA0AC. Twelve bytes: the device's own MAC reversed, then a six-byte
payload. XOR every payload byte with 0xA0 except the last two, which are in
clear, and it reads:
d[0] status, bit 7 set = settled
d[1..3] weight, 24-bit big-endian grams, biased by 0x8C0000
p[4] frame type, 0x0D weight, 0x06 post-weigh-in
p[5] checksum, 0xA0 + ((p0+p1+p2+p3+p4) & 0x1F)
Verified against both captures: the checksum closes on 127 of 127 frames, the
settled frames read 108.480 kg and 5.610 kg against displays of 108.5 and 5.6,
and the idle frame that appears byte for byte in BOTH captures reads exactly
zero, which is what fixes the bias rather than fitting it to one session.
Only settled frames are published. The settling stream swings from 39.60
through 107.03 kg on the way up in the 108.5 kg capture, so publishing any of it
would publish a weight the scale never showed.
The type 0x06 frame is logged and not published. Its field reads 529 for the
108.5 kg adult and 0 for the 5.6 kg object, which is the right shape and
magnitude for a whole-body impedance, but one sample is not a decode.
The node-ble passive path only ever read ServiceData, so a manufacturer-data
broadcast scale would have worked on Noble and been dead on a Raspberry Pi and
in the add-on. It now reads ManufacturerData through parseBroadcast as well, and
both passive gates accept either parser instead of requiring parseServiceData.
The pre-connect match also stopped throwing away the advertisement snapshot it
had already read. Matching on the local name alone could not reach this device
at all, since it calls itself "108", while its manufacturer data identifies it
exactly. The snapshot result feeds the match only for the passive branch, so a
device that now matches a connect-based adapter falls through as before and is
re-resolved after discovery.
Closes #2971 parent 74bd6cd commit 53ed2d2
11 files changed
Lines changed: 505 additions & 98 deletions
File tree
- docs
- guide
- public
- src
- ble/handler-node-ble
- scales
- tests/scales
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
0 commit comments