Skip to content

Commit bd8b2cf

Browse files
committed
Make identifier locally available
1 parent 42b6ef0 commit bd8b2cf

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

custom_components/plugwise_usb/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ async def async_remove_config_entry_device(
179179
) -> bool:
180180
"""Remove a config entry from a device."""
181181
api_stick = config_entry.runtime_data[STICK]
182-
removable = not any(
183-
identifier
184-
for identifier in device_entry.identifiers
185-
if identifier[0] == DOMAIN
186-
and identifier[1] in (str(api_stick.mac_stick), str(api_stick.mac_coordinator))
187-
)
182+
removable = False
183+
for identifier in device_entry.identifiers:
184+
if (
185+
identifier[0] == DOMAIN
186+
and (mac := identifier[1] in (str(api_stick.mac_stick), str(api_stick.mac_coordinator)))
187+
):
188+
removable = True
189+
break
190+
188191
if removable:
189-
mac = identifier[1]
190192
try:
191193
await api_stick.unregister_node(mac)
192194
except NodeError as exc:

0 commit comments

Comments
 (0)