Skip to content

Commit

Permalink
fix: Local USB Bluetooth detection (#387) fixes #386
Browse files Browse the repository at this point in the history
* fix: Local USB Bluetooth detection

- fixes Failed to find Scanner (local USB Bluetooth) #386
- linting

* - linting
  • Loading branch information
agittins authored Nov 14, 2024
1 parent 6c670b7 commit 8f905a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions custom_components/bermuda/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def __init__(

self._manager: HomeAssistantBluetoothManager = _get_manager(hass) # instance of the bluetooth manager
self._hascanners: set[BaseHaScanner] # Links to the backend scanners
self._hascanner_timestamps: dict[str, dict[str, float]] = {} # scanner_address, device_address, stamp
self._hascanner_timestamps: dict[str, dict[str, float]] = {} # scanner_address, device_address, stamp

self._entity_registry = er.async_get(self.hass)
self._device_registry = dr.async_get(self.hass)
Expand Down Expand Up @@ -1121,7 +1121,7 @@ def _refresh_scanners(self, scanners: list[BluetoothScannerDevice] | None = None
scanner_devreg = self._device_registry.async_get_device(
connections={
("mac", scanner_address), # Matches ESPHome proxies, Shellys etc
("bluetooth", scanner_address), # Matches local USB Bluetooth (hci0..)
("bluetooth", scanner_address.upper()), # Matches local USB Bluetooth (hci0..)
}
)
if scanner_devreg is None:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/bermuda/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def _handle_coordinator_update(self) -> None:
"""
self.async_write_ha_state()

def _cached_ratelimit(self, statevalue: Any, interval:int|None=None):
def _cached_ratelimit(self, statevalue: Any, interval: int | None = None):
"""A simple way to rate-limit sensor updates."""
if interval is not None:
self._cache_ratelimit_interval = interval
Expand Down

0 comments on commit 8f905a4

Please sign in to comment.