Skip to content

Fix BLE connection line: address lives on BLEClient.bleak_client - #1025

Open
gchai wants to merge 1 commit into
meshtastic:masterfrom
gchai:fix/ble-connection-address
Open

gchai wants to merge 1 commit into
meshtastic:masterfrom
gchai:fix/ble-connection-address

Conversation

@gchai

@gchai gchai commented Nov 26, 2026 •

Copy link
Copy Markdown

Since #998, every meshtastic --ble <device> ... run aborts right after connecting:

Aborting due to: 'BLEClient' object has no attribute 'address'

onConnected prints interface.client.address, but BLEInterface.client is a BLEClient, which wraps a BleakClient and has no address of its own. The fix reads interface.client.bleak_client.address.

The existing test_on_connected_transport case faked client as SimpleNamespace(address=...), so it passed against the broken code. It now uses the real shape (client.bleak_client.address), and fails without the fix.

Testing

  • pytest -k on_connected: 7 passed; the BLE case fails on master.
  • Hardware: macOS, Heltec MeshPocket. meshtastic --ble ethl_5372 --get bluetooth aborts on master and prints Connected to radio via BLE <address> followed by the settings with this change.

Summary by CodeRabbit

  • Bug Fixes
    • BLE connection messages now display the device address reported by the BLE client.

meshtastic#998 prints the BLE endpoint as interface.client.address, but BLEInterface.client is a
BLEClient, which has no address attribute (it wraps a BleakClient). Every
'meshtastic --ble ...' run aborted with "'BLEClient' object has no attribute
'address'". The test faked a client with a top-level address, so it passed;
it now uses the real shape.
@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The BLE connection message now reads the device address from interface.client.bleak_client.address. The BLE reporting test fixture uses the same nested address structure.

Changes: BLE connection reporting

Layer / File(s) Summary
BLE address lookup and test
meshtastic/__main__.py, meshtastic/tests/test_main.py
The BLE connection message reads the address from interface.client.bleak_client.address. The test fixture uses this nested structure; the expected message is unchanged.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Possibly related PRs

  • meshtastic/python#998: Added the connected-transport report whose BLE address lookup this change updates.

Suggested reviewers: the8thbit

Merge Risk: Minimal · up to 9dff3

This fixes the BLE connection message so that meshtastic --ble no longer aborts when printing the device address. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the BLE connection line now reads the address from BLEClient.bleak_client. The raw summary confirms the lookup in meshtastic/main.py moved from interface.client.ad…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the BLE connection line now reads the address from BLEClient.bleak_client. The raw summary confirms the lookup in meshtastic/main.py moved from interface.client.address to interface.client.bleak_client.address, and the test was updated to match. The title is specific and matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 795a0f0 and 9dff3cc.

Files selected for processing: 2

  • meshtastic/__main__.py
  • meshtastic/tests/test_main.py

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

This branch has not been deployed

No deployments
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.

1 participant