Skip to content

Commit

Permalink
fix: IRK devices temporary unavail on mac rotation
Browse files Browse the repository at this point in the history
- Fixes Devices go unavailable every few mins for a few seconds #362
- Fix insert when velo_max is exceeded but the hist_distance_by_interval was empty (such as after MAC rotation)
  • Loading branch information
agittins committed Nov 13, 2024
1 parent 841bf87 commit e7f9949
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/bermuda/bermuda_device_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ def calculate_data(self):
velocity,
)
# Discard the bogus reading by duplicating the last.
self.hist_distance_by_interval.insert(0, self.hist_distance_by_interval[0])
if len(self.hist_distance_by_interval) == 0:
self.hist_distance_by_interval = [self.rssi_distance_raw]
else:
self.hist_distance_by_interval.insert(0, self.hist_distance_by_interval[0])
else:
# Looks valid enough, add the current reading to the interval log
self.hist_distance_by_interval.insert(0, self.rssi_distance_raw)
Expand Down

0 comments on commit e7f9949

Please sign in to comment.