mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Allow wifi switches for mesh repeaters in AVM Fritz!Box Tools (#135456)
* create wifi switches for mesh slaves, but disable them by default * check if mesh isbased on wifi uplink * fix
This commit is contained in:
parent
2d5e920de0
commit
f67fb9985e
@ -196,6 +196,7 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
|||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.host = host
|
self.host = host
|
||||||
self.mesh_role = MeshRoles.NONE
|
self.mesh_role = MeshRoles.NONE
|
||||||
|
self.mesh_wifi_uplink = False
|
||||||
self.device_conn_type: str | None = None
|
self.device_conn_type: str | None = None
|
||||||
self.device_is_router: bool = False
|
self.device_is_router: bool = False
|
||||||
self.password = password
|
self.password = password
|
||||||
@ -610,6 +611,12 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
|||||||
ssid=interf.get("ssid", ""),
|
ssid=interf.get("ssid", ""),
|
||||||
type=interf["type"],
|
type=interf["type"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if interf["type"].lower() == "wlan" and interf[
|
||||||
|
"name"
|
||||||
|
].lower().startswith("uplink"):
|
||||||
|
self.mesh_wifi_uplink = True
|
||||||
|
|
||||||
if dr.format_mac(int_mac) == self.mac:
|
if dr.format_mac(int_mac) == self.mac:
|
||||||
self.mesh_role = MeshRoles(node["mesh_role"])
|
self.mesh_role = MeshRoles(node["mesh_role"])
|
||||||
|
|
||||||
|
@ -207,8 +207,9 @@ async def async_all_entities_list(
|
|||||||
local_ip: str,
|
local_ip: str,
|
||||||
) -> list[Entity]:
|
) -> list[Entity]:
|
||||||
"""Get a list of all entities."""
|
"""Get a list of all entities."""
|
||||||
|
|
||||||
if avm_wrapper.mesh_role == MeshRoles.SLAVE:
|
if avm_wrapper.mesh_role == MeshRoles.SLAVE:
|
||||||
|
if not avm_wrapper.mesh_wifi_uplink:
|
||||||
|
return [*await _async_wifi_entities_list(avm_wrapper, device_friendly_name)]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@ -565,6 +566,9 @@ class FritzBoxWifiSwitch(FritzBoxBaseSwitch):
|
|||||||
|
|
||||||
self._attributes = {}
|
self._attributes = {}
|
||||||
self._attr_entity_category = EntityCategory.CONFIG
|
self._attr_entity_category = EntityCategory.CONFIG
|
||||||
|
self._attr_entity_registry_enabled_default = (
|
||||||
|
avm_wrapper.mesh_role is not MeshRoles.SLAVE
|
||||||
|
)
|
||||||
self._network_num = network_num
|
self._network_num = network_num
|
||||||
|
|
||||||
switch_info = SwitchInfo(
|
switch_info = SwitchInfo(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user