mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
check wan access type (#65389)
This commit is contained in:
parent
341d039252
commit
dc65c621ed
@ -586,11 +586,11 @@ class AvmWrapper(FritzBoxTools):
|
|||||||
)
|
)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
async def async_get_wan_dsl_interface_config(self) -> dict[str, Any]:
|
async def async_get_wan_link_properties(self) -> dict[str, Any]:
|
||||||
"""Call WANDSLInterfaceConfig service."""
|
"""Call WANCommonInterfaceConfig service."""
|
||||||
|
|
||||||
return await self.hass.async_add_executor_job(
|
return await self.hass.async_add_executor_job(
|
||||||
partial(self.get_wan_dsl_interface_config)
|
partial(self.get_wan_link_properties)
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_get_wan_link_properties(self) -> dict[str, Any]:
|
async def async_get_wan_link_properties(self) -> dict[str, Any]:
|
||||||
@ -697,10 +697,12 @@ class AvmWrapper(FritzBoxTools):
|
|||||||
|
|
||||||
return self._service_call_action("WLANConfiguration", str(index), "GetInfo")
|
return self._service_call_action("WLANConfiguration", str(index), "GetInfo")
|
||||||
|
|
||||||
def get_wan_dsl_interface_config(self) -> dict[str, Any]:
|
def get_wan_link_properties(self) -> dict[str, Any]:
|
||||||
"""Call WANDSLInterfaceConfig service."""
|
"""Call WANCommonInterfaceConfig service."""
|
||||||
|
|
||||||
return self._service_call_action("WANDSLInterfaceConfig", "1", "GetInfo")
|
return self._service_call_action(
|
||||||
|
"WANCommonInterfaceConfig", "1", "GetCommonLinkProperties"
|
||||||
|
)
|
||||||
|
|
||||||
def get_wan_link_properties(self) -> dict[str, Any]:
|
def get_wan_link_properties(self) -> dict[str, Any]:
|
||||||
"""Call WANCommonInterfaceConfig service."""
|
"""Call WANCommonInterfaceConfig service."""
|
||||||
|
@ -277,10 +277,14 @@ async def async_setup_entry(
|
|||||||
_LOGGER.debug("Setting up FRITZ!Box sensors")
|
_LOGGER.debug("Setting up FRITZ!Box sensors")
|
||||||
avm_wrapper: AvmWrapper = hass.data[DOMAIN][entry.entry_id]
|
avm_wrapper: AvmWrapper = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
dsl: bool = False
|
link_properties = await avm_wrapper.async_get_wan_link_properties()
|
||||||
dslinterface = await avm_wrapper.async_get_wan_dsl_interface_config()
|
dsl: bool = link_properties.get("NewWANAccessType") == "DSL"
|
||||||
if dslinterface:
|
|
||||||
dsl = dslinterface["NewEnable"]
|
_LOGGER.debug(
|
||||||
|
"WANAccessType of FritzBox %s is '%s'",
|
||||||
|
avm_wrapper.host,
|
||||||
|
link_properties.get("NewWANAccessType"),
|
||||||
|
)
|
||||||
|
|
||||||
entities = [
|
entities = [
|
||||||
FritzBoxSensor(avm_wrapper, entry.title, description)
|
FritzBoxSensor(avm_wrapper, entry.title, description)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user