Python client library for the OHF Matter Server BLE proxy protocol
Project description
matter-ble-proxy
Python client library for the OHF Matter Server BLE proxy WebSocket protocol.
The matter-server can run on a host with no BLE adapter and delegate every BLE operation to a separate process or device. This library implements the client side of that protocol so that any Python process with access to a BLE adapter (via Bleak, Home Assistant's bluetooth component, an ESPHome BLE proxy, ...) can act as the BLE bridge.
The protocol is documented in docs/ble-proxy-protocol.md.
Install
pip install matter-ble-proxy
Python 3.12+ required.
Standalone CLI
The package ships a reference CLI mirroring the JS noble-ble-proxy example.
Useful for testing the matter-server's /ble endpoint without Home Assistant
in the loop.
# Start the matter-server with --ble-proxy in one terminal, then:
matter-ble-proxy --server ws://localhost:5580/ble
The CLI uses Bleak directly against the local OS bluetooth adapter.
Library API
For integrators (Home Assistant, custom add-ons, etc.) wire your own BLE source in by implementing two ABCs:
from matter_ble_proxy import (
AdvertisementData,
BleDeviceResolver,
BleScanSource,
MatterBleProxy,
)
class MyScanSource(BleScanSource):
async def start(self, callback): ... # call `callback(AdvertisementData(...))`
async def stop(self): ...
class MyDeviceResolver(BleDeviceResolver):
async def resolve(self, address): ... # return a bleak.BLEDevice / address / None
proxy = MatterBleProxy(
ws_url="ws://localhost:5580/ble",
scan_source=MyScanSource(),
device_resolver=MyDeviceResolver(),
)
await proxy.connect()
await proxy.run_until_closed()
await proxy.disconnect()
The default Bleak-backed implementations (BleakScanSource,
BleakDeviceResolver) live in matter_ble_proxy.bleak_backend.
Reconnection
MatterBleProxy does not reconnect on its own. When the WebSocket closes — server
restart, network blip, or the caller calling disconnect() — run_until_closed()
returns after the library releases all BLE resources (active scan stopped, every
peripheral disconnected). The caller decides whether to reconnect:
- The bundled CLI exits on disconnect; restart it manually.
- Home Assistant ties the BLE proxy lifecycle to the matter-server WebSocket: when
HA reconnects to the matter-server it constructs and connects a fresh
MatterBleProxyfor the new session. - A custom integration can wrap
connect()+run_until_closed()in a retry loop with whatever backoff and cancellation policy fits its supervisor.
The library deliberately stays out of this decision so it can plug into hosts that already own reconnect logic (HA, systemd, etc.) without fighting them.
Development
This package lives inside the matter-js/matterjs-server repo and shares its release pipeline. From the repo root:
npm run python-ble-proxy:install # create venv + install editable + test deps
npm run python-ble-proxy:lint # ruff
npm run python-ble-proxy:typecheck # mypy
npm run python-ble-proxy:test # pytest
npm run python-ble-proxy:build # build sdist+wheel
Project details
Release history Release notifications | RSS feed
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 matter_ble_proxy-0.7.1.tar.gz.
File metadata
- Download URL: matter_ble_proxy-0.7.1.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
847f5c869526ae623f5be9f033403313e91ef593b94b1d41514a2eb4b94c9616
|
|
| MD5 |
c82419297049a1ad93e3d174e5a22148
|
|
| BLAKE2b-256 |
d37c93045b18c90c225d5b58dba594500ca3041ec90922930a60a920f910b29d
|
Provenance
The following attestation bundles were made for matter_ble_proxy-0.7.1.tar.gz:
Publisher:
release-npm.yml on matter-js/matterjs-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matter_ble_proxy-0.7.1.tar.gz -
Subject digest:
847f5c869526ae623f5be9f033403313e91ef593b94b1d41514a2eb4b94c9616 - Sigstore transparency entry: 1591776640
- Sigstore integration time:
-
Permalink:
matter-js/matterjs-server@9ef5485b3725f87c10028629f50a932e8fb1a0b0 -
Branch / Tag:
refs/pull/676/merge - Owner: https://github.com/matter-js
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-npm.yml@9ef5485b3725f87c10028629f50a932e8fb1a0b0 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file matter_ble_proxy-0.7.1-py3-none-any.whl.
File metadata
- Download URL: matter_ble_proxy-0.7.1-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca79d636f9aed217fe229f04c2f049df38935845c6beb7fd2da360ac6f513057
|
|
| MD5 |
696b385104bbfeb7b459b0e0998fc18b
|
|
| BLAKE2b-256 |
a1367dd6213767204c5bdef8a2116607c6eb2752e1b0a6ee406c337ddc8aa69f
|
Provenance
The following attestation bundles were made for matter_ble_proxy-0.7.1-py3-none-any.whl:
Publisher:
release-npm.yml on matter-js/matterjs-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matter_ble_proxy-0.7.1-py3-none-any.whl -
Subject digest:
ca79d636f9aed217fe229f04c2f049df38935845c6beb7fd2da360ac6f513057 - Sigstore transparency entry: 1591776705
- Sigstore integration time:
-
Permalink:
matter-js/matterjs-server@9ef5485b3725f87c10028629f50a932e8fb1a0b0 -
Branch / Tag:
refs/pull/676/merge - Owner: https://github.com/matter-js
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-npm.yml@9ef5485b3725f87c10028629f50a932e8fb1a0b0 -
Trigger Event:
pull_request
-
Statement type: