Skip to content

Commit e7f9949

Browse files
committed
fix: IRK devices temporary unavail on mac rotation
- 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)
1 parent 841bf87 commit e7f9949

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

custom_components/bermuda/bermuda_device_scanner.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,10 @@ def calculate_data(self):
401401
velocity,
402402
)
403403
# Discard the bogus reading by duplicating the last.
404-
self.hist_distance_by_interval.insert(0, self.hist_distance_by_interval[0])
404+
if len(self.hist_distance_by_interval) == 0:
405+
self.hist_distance_by_interval = [self.rssi_distance_raw]
406+
else:
407+
self.hist_distance_by_interval.insert(0, self.hist_distance_by_interval[0])
405408
else:
406409
# Looks valid enough, add the current reading to the interval log
407410
self.hist_distance_by_interval.insert(0, self.rssi_distance_raw)

0 commit comments

Comments
 (0)