File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 5353
5454
5555FAILED_ADAPTER_MAC = "00:00:00:00:00:00"
56+
57+
58+ ADV_RSSI_SWITCH_THRESHOLD : Final = 10
59+ # The switch threshold for the rssi value
60+ # to switch to a different adapter for advertisements
61+ # Note that this does not affect the connection
62+ # selection that uses RSSI_SWITCH_THRESHOLD from
63+ # bleak_retry_connector
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ from .base_scanner cimport BaseHaScanner
55from .models cimport BluetoothServiceInfoBleak
66
77cdef int NO_RSSI_VALUE
8- cdef int RSSI_SWITCH_THRESHOLD
8+ cdef int ADV_RSSI_SWITCH_THRESHOLD
99cdef double TRACKER_BUFFERING_WOBBLE_SECONDS
1010cdef double FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS
1111cdef object FILTER_UUIDS
Original file line number Diff line number Diff line change 1010from typing import TYPE_CHECKING , Any , Final
1111
1212from bleak .backends .scanner import AdvertisementDataCallback
13- from bleak_retry_connector import NO_RSSI_VALUE , RSSI_SWITCH_THRESHOLD , BleakSlotManager
13+ from bleak_retry_connector import NO_RSSI_VALUE , BleakSlotManager
1414from bluetooth_adapters import (
1515 ADAPTER_ADDRESS ,
1616 ADAPTER_PASSIVE_SCAN ,
2424 AdvertisementTracker ,
2525)
2626from .const import (
27+ ADV_RSSI_SWITCH_THRESHOLD ,
2728 CALLBACK_TYPE ,
2829 FAILED_ADAPTER_MAC ,
2930 FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS ,
@@ -430,10 +431,10 @@ def _prefer_previous_adv_from_different_source(
430431 stale_seconds ,
431432 )
432433 return False
433- if (new .rssi or NO_RSSI_VALUE ) - RSSI_SWITCH_THRESHOLD > (
434+ if (new .rssi or NO_RSSI_VALUE ) - ADV_RSSI_SWITCH_THRESHOLD > (
434435 old .rssi or NO_RSSI_VALUE
435436 ):
436- # If new advertisement is RSSI_SWITCH_THRESHOLD more,
437+ # If new advertisement is ADV_RSSI_SWITCH_THRESHOLD more,
437438 # the new one is preferred.
438439 if self ._debug :
439440 _LOGGER .debug (
@@ -446,7 +447,7 @@ def _prefer_previous_adv_from_different_source(
446447 self ._async_describe_source (old ),
447448 self ._async_describe_source (new ),
448449 new .rssi ,
449- RSSI_SWITCH_THRESHOLD ,
450+ ADV_RSSI_SWITCH_THRESHOLD ,
450451 old .rssi ,
451452 )
452453 return False
You can’t perform that action at this time.
0 commit comments