Embody BLE
Features
- Connects to an EmBody device over BLE (Bluetooth) using Bleak
- Uses the EmBody protocol to communicate with the device
- Integrates with the EmBody Protocol Codec project
- Asynchronous send without having to wait for response
- Synchronous send where response message is returned
- Provides callback interfaces for incoming messages, response messages and connect/disconnect
- Facade method to send/receive BLE messages directly
- All methods and callbacks are threadsafe
- Separate threads for send, receive and callback processing
- Type safe code using ty for type checking
- High level callback interface for attribute reporting
Requirements
- Python 3.12-3.13
- Access to private Aidee Health repositories on Github
Installation
You can install Embody BLE via pip:
$ pip install embody-ble
This adds embody-ble as a library, but also provides the CLI application with the same name.
Usage
A very basic example where you send a message request and get a response:
from embodyble.embodyble import EmbodyBle
from embodyserial.helpers import EmbodySendHelper
embody_ble = EmbodyBle()
send_helper = EmbodySendHelper(sender=embody_ble)
embody_ble.connect()
print(f"Serial no: {send_helper.get_serial_no()}")
embody_ble.shutdown()
If you want to see more of what happens under the hood, activate debug logging before setting up EmbodyBle:
import logging
logging.basicConfig(level=logging.DEBUG)
Using the application from the command line
The application also provides a CLI application that is automatically added to the path when installing via pip.
Once installed with pip, type:
embody-ble --help
To see which options are available.
Note The serial port is automatically detected, but can be overridden by using the
--deviceoption.
Example - Attribute reporting
To see how attribute reporting can be configured, have a look at the example in examples/ble_reporting_example.py
You can also test attribute reporting using the cli:
embody-ble --log-level INFO --report-attribute battery_level --report-interval 1
embody-ble --log-level INFO --report-attribute heart_rate --report-interval 1000
Example - List all available EmBody devices
embody-ble --list-devices
Example - List all attribute values
embody-ble --get-all
Example - Get serial no of device
embody-ble --get serialno
Example - List files over serial port
embody-ble --list-files
Example - Set time current time (UTC)
embody-ble --set-time
Logging
This library uses Python's standard logging module and follows best practices for libraries:
For Library Users
The library is silent by default - it won't produce any output unless you configure logging. To enable logging from the library:
import logging
# Enable INFO level logging for embodyble
logging.getLogger('embodyble').setLevel(logging.INFO)
logging.getLogger('embodyble').addHandler(logging.StreamHandler())
# Or configure specific modules
logging.getLogger('embodyble.embodyble').setLevel(logging.DEBUG)
For CLI Users
The CLI configures logging automatically. Use --log-level to control verbosity:
embody-ble --log-level DEBUG --list-devices
Available levels: CRITICAL, WARNING, INFO, DEBUG
Troubleshooting
No known issues registered.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Metadata
Release files for embody-ble 1.1.32
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| embody_ble-1.1.32.tar.gz | 19.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| embody_ble-1.1.32-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.3 kB
Release files / embody_ble-1.1.32.tar.gz
| Download URL | embody_ble-1.1.32.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce77eab798a639557916181b87c4187177e49bd7d1de1422ddebdd36d1aa3a13
|
|
BLAKE2b-256 checksum How to use checksums |
4650f5d71c42be840560c0d22c7428e116a445385d31dedfc7e5d8949db6bd7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / embody_ble-1.1.32-py3-none-any.whl
| Download URL | embody_ble-1.1.32-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de2fd30fef366735edce14783be2287b672c8ced2b4b47ab0a6542dd91ee8f82
|
|
BLAKE2b-256 checksum How to use checksums |
be8d4f973f505c6d796369d04ac1dce7a25d556d832cf7c58d8cfd58e49248e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Security for embody-ble 1.1.32
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.