Skip to content

Commit

Permalink
Implement as suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
bouwew committed Aug 13, 2024
1 parent a7c4ad3 commit b88d1ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugwise/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def _detect_low_batteries(self) -> list[str]:
mac_address: str | None = None
message: str | None = notification.get("message")
if message is not None and all(x in message for x in matches):
mac_address = re.findall(mac_pattern, message)[0] # re.findall() outputs a list
mac_addresses = re.findall(mac_pattern, message)
if mac_addresses:
mac_address = mac_addresses[0] # re.findall() outputs a list

if mac_address is not None:
self._notifications.pop(msg_id)
Expand Down

0 comments on commit b88d1ac

Please sign in to comment.