polar-ble-tools
Offline-first Python tools for on-device data collection and local retrieval from supported Polar wearable devices over Bluetooth Low Energy.
Currently supported devices are Polar Loop Gen 2 and Polar Verity Sense. Support is limited to the controlled, device-specific behavior documented in the compatibility matrix.
polar-ble-tools supports workflows in which a wearable records data to its
own storage and the resulting files are retrieved later over BLE. It provides
device setup, offline recording control, PFTP file retrieval, integrity
manifests, guarded cleanup, and optional local decoding for supported formats.
Data collection and retrieval do not require Polar Flow.
This repository is deliberately limited to BLE tooling: protocol access, device-facing operations, local persistence safeguards, and helpers that make one BLE operation safe and usable. Higher-level application orchestration belongs in an orchestration layer built on these APIs, and is out of scope for this project.
polar-ble-toolsis an unofficial community project. It is not affiliated with, endorsed by, sponsored by, or maintained by Polar Electro Oy.
Capabilities
- manage supported PMD offline recordings and recording settings;
- list, retrieve, and manage device-resident files through PFTP;
- retrieve raw
.RECrecordings with SHA-256 manifests and guarded cleanup; - retrieve passive
.BPBfiles and decode supported data with local schemas; - discover devices, prepare fresh Linux devices, and run bounded managed sessions through Bleak;
- validate and apply first-time-use (FTU) data;
- generate and verify optional local schemas from a separately obtained SDK;
- locally decode supported
.RECfiles to validated JSONL with an optional SDK sidecar.
Installation
Device operations require Linux and BlueZ. Python 3.11 or newer is required;
versions 3.11 through 3.14 are tested. The package uses Bleak for scanning and
device sessions. Fresh Linux
preparation lazily uses a narrow D-Bus BlueZ authentication agent; no
bluetoothctl subprocess is required.
python -m pip install polar-ble-tools
polar-ble --help
Install the optional schema compiler only for SDK-assisted FTU encoding and BPB decoding:
python -m pip install "polar-ble-tools[sdk]"
polar-ble sdk install
The installer asks for a simple y/N confirmation that proceeding accepts the
Polar BLE SDK licence. This happens on every install/download invocation,
including cache reuse. Use -y for non-interactive installation.
Quick start
Discover, prepare, and probe a device:
polar-ble discover --timeout 15 --name Polar
polar-ble prepare --device-identifier AA:BB:CC:DD:EE:FF
polar-ble connect --device-identifier AA:BB:CC:DD:EE:FF
prepare first checks pair-free readiness, uses the target-bound Linux agent
only when authentication is required, then verifies an agent-free reconnect.
connect is a readiness probe; both commands finish disconnected.
First-time setup for Polar Loop Gen 2
For a Loop Gen 2 that has not completed first-time setup, copy the Loop Gen 2 FTU profile example to a private location and replace every value. The profile contains personal physical data and must not be committed or placed in shared logs. FTU requires the optional generated-schema cache installed above.
Validate the profile without contacting the device, then apply it and confirm completion:
polar-ble ftu dry-run \
--profile ~/.config/polar-ble-tools/ftu-profile.json
polar-ble ftu --device-identifier AA:BB:CC:DD:EE:FF apply \
--profile ~/.config/polar-ble-tools/ftu-profile.json
polar-ble ftu --device-identifier AA:BB:CC:DD:EE:FF status
First-time setup for Polar Verity Sense
Copy the
Verity Sense FTU profile example
to a private location and select the wear location. Validate and apply it with
the same ftu dry-run and ftu apply commands. Verity FTU sets system/local
time from the timezone-aware host clock after connecting, then applies wear
location. Time is runtime state and is not stored in the profile. Pool length
is rejected because its device write contract is not supported.
Passive data from Polar Loop Gen 2
After the device has accumulated data, replace the example dates with the
bounded range to retrieve. Collection persists and hashes the raw .BPB files
before optional decoding:
polar-ble passive --device-identifier AA:BB:CC:DD:EE:FF \
--from-date 2026-07-23 --to-date 2026-07-29 collect --decode
Omit --decode to collect raw passive files without an active schema cache.
Offline REC recordings
Polar Loop Gen 2 and Polar Verity Sense both support the raw REC workflow. Inspect the device-supported types and settings, start an ACC recording, then stop and collect it after the desired duration:
polar-ble raw --device-identifier AA:BB:CC:DD:EE:FF types
polar-ble raw --device-identifier AA:BB:CC:DD:EE:FF \
settings --type ACC --full
polar-ble raw --device-identifier AA:BB:CC:DD:EE:FF \
start --type ACC --setting sample_rate=52
# Run the stop command after the desired recording duration.
polar-ble raw --device-identifier AA:BB:CC:DD:EE:FF stop --type ACC
polar-ble raw --device-identifier AA:BB:CC:DD:EE:FF collect --type ACC
Raw REC collection is SDK-free. Structured REC decoding is a separate, experimental workflow requiring the optional local sidecar.
See device setup for the complete FTU workflow. See offline recording, raw retrieval, and REC decoding for the complete REC workflows and supported types.
Compatibility
Controlled hardware validation covers Polar Loop Gen 2 and Polar Verity Sense on Linux/BlueZ. Other devices exposing the required PMD and PFTP services may work but are not confirmed for this release. See compatibility for the verified capability matrix and limitations.
Optional SDK functionality
The package does not distribute the Polar BLE SDK, Polar SDK schema files, or artefacts generated from those files. Optional SDK-assisted functionality uses an SDK copy separately obtained and licensed by the user. SDK operations are explicit commands; package installation and import never download, generate, or activate SDK material. Structured REC decoding additionally requires a locally built optional sidecar. See SDK integration, REC decoding, and compatibility for prerequisites and evidence-backed limitations.
Documentation
- Device setup
- Configuration and CLI
- CLI reference
- Python API reference
- Compatibility
- Troubleshooting
- Contributor guide
Licence and trademarks
Project-authored content is licensed under the Apache License 2.0. See NOTICE for attribution, trademark, and SDK-separation notices.
Polar and related product names are trademarks of Polar Electro Oy and are used solely to identify compatible devices.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polar_ble_tools-0.5.0.tar.gz.
File metadata
- Download URL: polar_ble_tools-0.5.0.tar.gz
- Upload date:
- Size: 122.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33860d149e9d6913875ab1edd50525068f6779261bd2e2ebd82b717d45ad2481
|
|
| MD5 |
539919c2b030d84bb48a8bb5d2bf542f
|
|
| BLAKE2b-256 |
90186cd80564c2e4fa9c2757b660acc555121ef309996c21471a159544954f04
|
Provenance
The following attestation bundles were made for polar_ble_tools-0.5.0.tar.gz:
Publisher:
pypi-release.yml on zyf0717/polar-ble-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polar_ble_tools-0.5.0.tar.gz -
Subject digest:
33860d149e9d6913875ab1edd50525068f6779261bd2e2ebd82b717d45ad2481 - Sigstore transparency entry: 2298029353
- Sigstore integration time:
-
Permalink:
zyf0717/polar-ble-tools@7eea94d5afc1f173cd185316f7ae830868672391 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/zyf0717
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@7eea94d5afc1f173cd185316f7ae830868672391 -
Trigger Event:
push
-
Statement type:
File details
Details for the file polar_ble_tools-0.5.0-py3-none-any.whl.
File metadata
- Download URL: polar_ble_tools-0.5.0-py3-none-any.whl
- Upload date:
- Size: 157.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d37494a9577fd31081cd356492787017f0742ca8bb43353fa49b1345def8c70
|
|
| MD5 |
62efd79bfee8fbbf8858aa7a23144232
|
|
| BLAKE2b-256 |
8b3385a9bf448b70f63bae383befd59d359febb8994043fe147113a00e68502e
|
Provenance
The following attestation bundles were made for polar_ble_tools-0.5.0-py3-none-any.whl:
Publisher:
pypi-release.yml on zyf0717/polar-ble-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polar_ble_tools-0.5.0-py3-none-any.whl -
Subject digest:
2d37494a9577fd31081cd356492787017f0742ca8bb43353fa49b1345def8c70 - Sigstore transparency entry: 2298029385
- Sigstore integration time:
-
Permalink:
zyf0717/polar-ble-tools@7eea94d5afc1f173cd185316f7ae830868672391 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/zyf0717
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@7eea94d5afc1f173cd185316f7ae830868672391 -
Trigger Event:
push
-
Statement type: