From 5c4f838fff2daaba207e6ee6a66c1445c158ebef Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Tue, 12 Mar 2024 12:06:24 +0000 Subject: [PATCH] Bugfix matching devices --- custom_components/battery_notes/library.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/battery_notes/library.py b/custom_components/battery_notes/library.py index d1b73ad71..9b9a30523 100644 --- a/custom_components/battery_notes/library.py +++ b/custom_components/battery_notes/library.py @@ -108,6 +108,9 @@ async def get_device_battery_details( ): matching_devices.append(device) + if matching_devices is None or not matching_devices or len(matching_devices) == 0: + return None + # Check if any matching devices have specified hw_version for device in matching_devices: if device.get("hw_version", "").casefold() == str(model_info.hw_version or "").casefold():