Add IPv6 sensor to fritz component (#75708)
* Add IPv6 sensor to fritz component * Cast return type to string * Make ipv6 sensor suitable * simplify cast to str * use extisting property Co-authored-by: chemelli74 <simone.chemelli@gmail.com> Co-authored-by: mib1185 <mail@mib85.de>
This commit is contained in:
parent
0f83db82d9
commit
64a72daa27
4 changed files with 27 additions and 0 deletions
|
@ -663,6 +663,14 @@ class AvmWrapper(FritzBoxTools):
|
|||
partial(self.get_wan_link_properties)
|
||||
)
|
||||
|
||||
async def async_ipv6_active(self) -> bool:
|
||||
"""Check ip an ipv6 is active on the WAn interface."""
|
||||
|
||||
def wrap_external_ipv6() -> str:
|
||||
return str(self.fritz_status.external_ipv6)
|
||||
|
||||
return bool(await self.hass.async_add_executor_job(wrap_external_ipv6))
|
||||
|
||||
async def async_get_connection_info(self) -> ConnectionInfo:
|
||||
"""Return ConnectionInfo data."""
|
||||
|
||||
|
@ -671,6 +679,7 @@ class AvmWrapper(FritzBoxTools):
|
|||
connection=link_properties.get("NewWANAccessType", "").lower(),
|
||||
mesh_role=self.mesh_role,
|
||||
wan_enabled=self.device_is_router,
|
||||
ipv6_active=await self.async_ipv6_active(),
|
||||
)
|
||||
_LOGGER.debug(
|
||||
"ConnectionInfo for FritzBox %s: %s",
|
||||
|
@ -1011,3 +1020,4 @@ class ConnectionInfo:
|
|||
connection: str
|
||||
mesh_role: MeshRoles
|
||||
wan_enabled: bool
|
||||
ipv6_active: bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue