Skip to content

Commit baa0b4c

Browse files
authored
feat: use set_*_mode helpers instead of setting mode directly (#189)
1 parent dd9cd27 commit baa0b4c

File tree

3 files changed

+12
-58
lines changed

3 files changed

+12
-58
lines changed

poetry.lock

Lines changed: 5 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ python = ">=3.11,<3.14"
3636
aioesphomeapi = ">=30.1.0"
3737
bleak = ">=1"
3838
bluetooth-data-tools = ">=1.18.0"
39-
habluetooth = ">=4"
39+
habluetooth = ">=5.2.0"
4040
lru-dict = ">=1.2.0"
4141
bleak-retry-connector = ">=3.8.0"
4242

src/bleak_esphome/backend/scanner.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ class ESPHomeScanner(BaseHaRemoteScanner):
2626
def async_update_scanner_state(self, state: BluetoothScannerStateResponse) -> None:
2727
"""Update the scanner state."""
2828
if state.mode == BluetoothScannerMode.ACTIVE:
29-
self.current_mode = BluetoothScanningMode.ACTIVE # type: ignore[misc]
30-
self.requested_mode = BluetoothScanningMode.ACTIVE # type: ignore[misc]
29+
self.set_requested_mode(BluetoothScanningMode.ACTIVE)
30+
self.set_current_mode(BluetoothScanningMode.ACTIVE)
3131
elif state.mode == BluetoothScannerMode.PASSIVE:
32-
self.current_mode = BluetoothScanningMode.PASSIVE
33-
self.requested_mode = BluetoothScanningMode.PASSIVE
32+
self.set_requested_mode(BluetoothScanningMode.PASSIVE)
33+
self.set_current_mode(BluetoothScanningMode.PASSIVE)
3434
else:
35-
self.current_mode = None
36-
self.requested_mode = None
35+
self.set_current_mode(None)
36+
self.set_requested_mode(None)
3737

3838
def async_on_advertisement(self, adv: BluetoothLEAdvertisement) -> None:
3939
"""Call the registered callback."""

0 commit comments

Comments
 (0)