Add support for BP5360 / HEM-7377T1-ZAZ (+ Linux scan-during-connect)#69
Merged
Conversation
New device driver `deviceSpecific/hem-7377t1.py` for the Omron BP5360 (internal model HEM-7377T1-ZAZ, FCC ID Q6ZHEM7377T1). Same Omron service UUID (0000fe4a) and channel UUIDs as HEM-7380T1, HEM-7361T-family record bit layout, OS-managed bond (no token auth required). 100 records per user × 2 users at 0x01CC and 0x080C. Time sync intentionally not implemented yet — the BP5360 firmware requires a non-obvious byte-14 increment quirk in the time-sync write at 0x0088, which doesn't fit cleanly into the existing settings-cache flow without further work; raises a clear ValueError pointing this out. Verified end-to-end on Linux/BlueZ: pulls all 77 stored records, parses correctly, communication completes cleanly (3 of 4 runs — comparable to existing reliability for other Omron devices over BLE). Bundled with: Linux/BlueZ scan-during-connect workaround in main(). On multi-adapter Linux, BleakClient(MAC).connect() can time out even when the device is actively advertising (verified: 52 ad packets in 90s, RSSI -50, BlueZ Connect still timed out). Running an active BleakScanner in parallel keeps BlueZ in receive mode, so it acts on the next ad packet immediately. Scanner is started on Linux only (sys.platform check) and stopped in the existing finally block. Adapter is extracted from the BLEDevice's BlueZ path. NOTE: scanner is currently pinned to hci1 — needs to become a CLI arg or auto-detect before merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two improvements to the BP5360 driver beyond the initial proof of concept:
1. Empty-slot detection in deviceSpecific_ParseRecordFormat. BP5360's
unused user slot contains daily-summary or similar metadata that decodes
to nonsense dates if pushed through the full parser, producing a stream
of cryptic warnings ("month must be in 1..12, not 0"). Early-exit checks
on year (>= 2020), month/day/hour/minute ranges, and physiological BP
ranges now raise ValueError("record slot is empty") for invalid slots,
matching HEM-7380T1's convention.
2. Time sync (--timeSync) implementation. BP5360 stores its time block at
EEPROM 0x0040 (read) and accepts writes at 0x0088. Settings region
addresses are configured accordingly; settingsUnreadRecordsBytes is set
to a zero-length range as a placeholder until the unread-records counter
location is mapped (--newRecOnly is a follow-up).
The byte-14 quirk turns out NOT to be the running counter implied by the
original reverse engineering: byte 14 is a CHECKSUM of bytes 0-13,
matching the convention HEM-7361T uses. The earlier additive formula
new_byte14 = (old_byte14 + (new_sec - old_sec) + 1) & 0xff
was a coincidence: when only the second byte changes (and byte 4 changes
from 0x00 to 0x01), the checksum delta IS exactly N+1, so the additive
formula matched in the common case. It breaks when seconds wrap (delta
negative) or when other date components change. Computing the checksum
directly works in all cases. Verified: cuff returns success status
(no 0xe5 error) and "okay" display on 2/2 runs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Linux scan-during-connect block previously hardcoded
bluez={"adapter": "hci1"} for development testing. Replace with an
optional --adapter argument so users on multi-adapter systems can pin
the controller their cuff is bonded on. When omitted, BlueZ picks the
default — works on single-adapter setups and on multi-adapter setups
where the default controller is also the bonded one.
The BleakClient call in the same block already auto-extracts the
adapter from the discovered BLEDevice's BlueZ path, so this CLI flag
only governs the scanner's controller selection.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Empirically verified: BP5360 stores both cuff-User-1 and cuff-User-2 measurements in the same slot index (0x080C). They're distinguished by metadata bytes within the 16-byte record — byte 13 is consistently 0x01 for User 1 records, 0xFF for User 2 records. Guest measurements are not stored to EEPROM at all. The slot at 0x01CC is reserved but appears unused on the sample tested. This replaces the earlier docstring's "may not match cuff display" hedge with the actual mechanism. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the BP5360 row per maintainer request in issue userx14#67. Inserted next to HEM-7380T1 since both use OS-bonding (n/a in pairing column). Features: basic readout ✔, time sync ✔ (verified — see issue thread for byte-14 checksum details), new record counter ❌ (deferred — counter location not yet mapped for this device). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
From testing with bluez-5.84, there are no problems with your scan-during-connect modification, when testing with single adapter and hem-7322-t. Thanks for adding support for HEM-7377T and multi adapter. |
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.
Implements BP5360 (HEM-7377T1-ZAZ) support discussed in #67.
Five commits, separable for review:
f049488— Device driver (deviceSpecific/hem-7377t1.py) + Linux scan-during-connect block inomblepy.py main()152c907— Empty-slot detection + time sync (byte-14 checksum, matches HEM-7361T's convention)384ac31—--adapterCLI flag for multi-adapter Linux setups1635fd1— Driver docstring update with the empirical user-ID finding (byte 13: 0x01 = User 1, 0xFF = User 2)16318b0— README device support matrix entrySee #67 for the protocol notes (byte-14 checksum, pair-mode-only "okay"/"Err" display behavior, guest-not-stored, user-ID encoding) and the Linux scan-during-connect rationale.
Happy to split the Linux scan-during-connect change into its own PR if you'd prefer to review it separately from the BP5360 driver.