Skip to content

Commit

Permalink
chore: try another way
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Dec 22, 2024
1 parent 5df9ca2 commit d47e15f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bleak_esphome/backend/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ def async_on_raw_advertisements(
# Avoid enumeration of raw.advertisements in the loop
# because protobuf will always have an internal exception
# when the list is exhausted.
for i in range(len(raw.advertisements)):
adv = raw.advertisements[i]
adv_len_idx = len(raw.advertisements) - 1
for i, adv in enumerate(raw.advertisements):
self._async_on_advertisement(
int_to_bluetooth_address(adv.address),
adv.rssi,
*parse_advertisement_data_tuple((adv.data,)),
{"address_type": adv.address_type},
now,
)
if i == adv_len_idx:
# Break at the end since we are done
break

0 comments on commit d47e15f

Please sign in to comment.