Skip to content

Commit

Permalink
(fix) Fix advert freshness check
Browse files Browse the repository at this point in the history
  • Loading branch information
agittins committed Oct 12, 2023
1 parent e129345 commit 64c39d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/bermuda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ def __init__(
self.stamp = 0
else:
# Not a bluetooth_proxy device / remote scanner.
# FIXME: Work out how to handle a bluetooth adaptor's reports.
# FIXME: Work out how to handle a bluetooth adaptor's reports (as
# opposed to those from proxies).
# Options are:
# (a) find a timestamp somehwere
# (b) if we are doing updates as ads come in, use now()-some_safety_offset.
Expand Down Expand Up @@ -545,7 +546,7 @@ def _refresh_area_by_min_distance(self, device: BermudaDevice):
): # It's inside max_radius...
if closest_scanner is None or (
scanner.rssi_distance < closest_scanner.rssi_distance
and scanner.stamp > closest_scanner.stamp - ADVERT_FRESHTIME
or scanner.stamp > closest_scanner.stamp - ADVERT_FRESHTIME
): # This scanner is closer, and the advert is still fresh in comparison..
closest_scanner = scanner
if closest_scanner is not None:
Expand Down

0 comments on commit 64c39d5

Please sign in to comment.