Skip to content

Improve BLE device resolution and WalkingPad GATT locking#123

Open
Ceiku wants to merge 1 commit into
madmatah:mainfrom
Ceiku:fix/ble-resolution-and-gatt-locking
Open

Improve BLE device resolution and WalkingPad GATT locking#123
Ceiku wants to merge 1 commit into
madmatah:mainfrom
Ceiku:fix/ble-resolution-and-gatt-locking

Conversation

@Ceiku
Copy link
Copy Markdown

@Ceiku Ceiku commented May 19, 2026

Summary

  • Resolve a connectable BLEDevice via async_ble_device_from_address, with a fallback to async_scanner_devices_by_address (strongest RSSI) when the merged device is missing—common with sparse advertisements or Bluetooth proxies.
  • Use a single asyncio.Lock for connect, disconnect, and all GATT commands; the previous _begin_cmd() returned a new lock each time, so operations were not actually serialised.
  • Refresh the BLEDevice from Home Assistant before each connect so routing stays current.
  • Use device_registry.format_mac for unique_id in the Bluetooth async_step_device path so it matches async_step_bluetooth.

Test plan

  • Reload the integration with the WalkingPad powered and in range (local adapter or ESPHome Bluetooth proxy).
  • Confirm config entry setup succeeds when the pad is visible only on a secondary scanner path.
  • Verify sensors update and belt/speed controls still work when remote control is enabled.

Made with Cursor

Use async_scanner_devices_by_address when the merged BLE handle is missing,
refresh the BLEDevice before connect, fix per-call asyncio.Lock misuse, and
align Bluetooth config flow unique_id with format_mac.

Co-authored-by: Cursor <cursoragent@cursor.com>
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