Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions devolo_plc_api/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ async def _get_relevant_interfaces(self) -> list[str]:
interface: list[str] = []
for adapter in get_adapters():
interface.extend(
cast(str, ip.ip)
cast("str", ip.ip)
for ip in adapter.ips
if ip.is_IPv4 and ip_address(self.ip) in ip_network(f"{ip.ip}/{ip.network_prefix}", strict=False)
)
interface.extend(
cast(str, ip.ip[0])
cast("str", ip.ip[0])
for ip in adapter.ips
if ip.is_IPv6 and ip_address(self.ip) in ip_network(f"{ip.ip[0]}/{ip.network_prefix}", strict=False)
)
Expand Down
5 changes: 3 additions & 2 deletions devolo_plc_api/network/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Discover devices in your network."""

from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -69,6 +70,6 @@ def _interfaces() -> list[str]:
"""Get IP addresses not being localhost."""
interface: list[str] = []
for adapter in get_adapters():
interface.extend(cast(str, ip.ip) for ip in adapter.ips if ip.is_IPv4 and ip.ip != "127.0.0.1")
interface.extend(cast(str, ip.ip[0]) for ip in adapter.ips if ip.is_IPv6 and ip.ip[0] != "::1")
interface.extend(cast("str", ip.ip) for ip in adapter.ips if ip.is_IPv4 and ip.ip != "127.0.0.1")
interface.extend(cast("str", ip.ip[0]) for ip in adapter.ips if ip.is_IPv6 and ip.ip[0] != "::1")
return interface