Skip to content

Add --hci-id argument to python_ble_proxy#746

Open
2myaus wants to merge 6 commits into
matter-js:mainfrom
2myaus:python_ble_proxy_hci_id_arg
Open

Add --hci-id argument to python_ble_proxy#746
2myaus wants to merge 6 commits into
matter-js:mainfrom
2myaus:python_ble_proxy_hci_id_arg

Conversation

@2myaus

@2myaus 2myaus commented Jun 11, 2026

Copy link
Copy Markdown

This adds the --hci-id <id> argument to the python matter-ble-proxy package.
The argument is available on the nodejs noble-ble-proxy, but previously not on the python package

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to add a --hci-id <id> option to the Python matter-ble-proxy CLI, aligning it with the existing Node.js noble-based proxy by allowing selection of a specific Bluetooth adapter (e.g., hci0).

Changes:

  • Adds --hci-id to the Python BLE proxy CLI argument parser.
  • Extends the Bleak scanning backend to support selecting a BlueZ adapter via BleakScanner(..., bluez={adapter: ...}).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
python_ble_proxy/matter_ble_proxy/cli.py Adds --hci-id and threads it into the CLI entrypoint (currently not fully wired into the scanner).
python_ble_proxy/matter_ble_proxy/bleak_backend.py Adds adapter-selection support to BleakScanSource via BlueZ scanner args.

Comment thread python_ble_proxy/matter_ble_proxy/cli.py
Comment thread python_ble_proxy/matter_ble_proxy/cli.py Outdated
Comment thread python_ble_proxy/matter_ble_proxy/bleak_backend.py Outdated
@2myaus 2myaus marked this pull request as draft June 11, 2026 20:09
@2myaus 2myaus marked this pull request as ready for review June 12, 2026 15:05
@Apollon77 Apollon77 requested a review from Copilot June 14, 2026 13:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment on lines +40 to +45
parser.add_argument(
"--hci-id",
default=None,
type=int,
help="Bluetooth adapter HCI ID (e.g., 0 for hci0)",
)
Comment thread python_ble_proxy/matter_ble_proxy/bleak_backend.py Outdated
Comment thread python_ble_proxy/matter_ble_proxy/cli.py Outdated
@2myaus 2myaus marked this pull request as draft June 22, 2026 15:05
Note the OS/BLE backend limitation in the --hci-id argument description, and only pass bluez_args to BleakScanner if a hci id was provided
@2myaus 2myaus marked this pull request as ready for review June 22, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +59 to +68
# Bleak only supports specifying a hci device on Linux with BlueZ;
# per https://github.com/hbldh/bleak/discussions/867
if self._hci_device is not None:
bluez_args: BlueZScannerArgs = {"adapter": f"hci{self._hci_device}"}
self._scanner = BleakScanner(
detection_callback=self._on_detection,
bluez=bluez_args,
)
else:
self._scanner = BleakScanner(detection_callback=self._on_detection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants