Skip to content

Commit 0cc7e99

Browse files
authored
fix: revert to using Python API for scanner (#141)
1 parent 568d511 commit 0cc7e99

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,5 @@ module = "docs.*"
160160
ignore_errors = true
161161

162162
[build-system]
163-
requires = ['setuptools>=75.8.2', 'Cython>=3', "poetry-core>=2.0.0", "habluetooth"]
163+
requires = ['setuptools>=75.8.2', 'Cython>=3', "poetry-core>=2.0.0"]
164164
build-backend = "poetry.core.masonry.api"

src/bleak_esphome/backend/scanner.pxd

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11

2-
from habluetooth.base_scanner cimport BaseHaRemoteScanner
32

43
cdef object MONOTONIC_TIME
54
cdef object int_to_bluetooth_address
65
cdef object parse_advertisement_data_tuple
7-
8-
cdef class ESPHomeScanner(BaseHaRemoteScanner):
9-
pass

src/bleak_esphome/backend/scanner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ def async_on_raw_advertisements(
4545
# To work around this we use a for loop to iterate over
4646
# the repeated field since `PyUpb_RepeatedContainer_Subscript`
4747
# does not trigger the debug logging.
48+
on_raw = self._async_on_raw_advertisement
4849
for i in range(len(advertisements)):
4950
adv = advertisements[i]
50-
self._async_on_raw_advertisement(
51+
on_raw(
5152
int_to_bluetooth_address(adv.address),
5253
adv.rssi,
5354
adv.data,

0 commit comments

Comments
 (0)