Revert fritz pref_disable_new_entities handling (#56891)
This commit is contained in:
parent
0916322a43
commit
735c9f8f0b
3 changed files with 5 additions and 20 deletions
|
@ -54,7 +54,6 @@ def _is_tracked(mac: str, current_devices: ValuesView) -> bool:
|
|||
def device_filter_out_from_trackers(
|
||||
mac: str,
|
||||
device: FritzDevice,
|
||||
pref_disable_new_entities: bool,
|
||||
current_devices: ValuesView,
|
||||
) -> bool:
|
||||
"""Check if device should be filtered out from trackers."""
|
||||
|
@ -63,8 +62,6 @@ def device_filter_out_from_trackers(
|
|||
reason = "Missing IP"
|
||||
elif _is_tracked(mac, current_devices):
|
||||
reason = "Already tracked"
|
||||
elif pref_disable_new_entities:
|
||||
reason = "Disabled System Options"
|
||||
|
||||
if reason:
|
||||
_LOGGER.debug(
|
||||
|
|
|
@ -80,9 +80,7 @@ async def async_setup_entry(
|
|||
@callback
|
||||
def update_router() -> None:
|
||||
"""Update the values of the router."""
|
||||
_async_add_entities(
|
||||
router, async_add_entities, data_fritz, entry.pref_disable_new_entities
|
||||
)
|
||||
_async_add_entities(router, async_add_entities, data_fritz)
|
||||
|
||||
entry.async_on_unload(
|
||||
async_dispatcher_connect(hass, router.signal_device_new, update_router)
|
||||
|
@ -96,7 +94,6 @@ def _async_add_entities(
|
|||
router: FritzBoxTools,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
data_fritz: FritzData,
|
||||
pref_disable_new_entities: bool,
|
||||
) -> None:
|
||||
"""Add new tracker entities from the router."""
|
||||
|
||||
|
@ -105,9 +102,7 @@ def _async_add_entities(
|
|||
data_fritz.tracked[router.unique_id] = set()
|
||||
|
||||
for mac, device in router.devices.items():
|
||||
if device_filter_out_from_trackers(
|
||||
mac, device, pref_disable_new_entities, data_fritz.tracked.values()
|
||||
):
|
||||
if device_filter_out_from_trackers(mac, device, data_fritz.tracked.values()):
|
||||
continue
|
||||
|
||||
new_tracked.append(FritzBoxTracker(router, device))
|
||||
|
|
|
@ -277,7 +277,6 @@ def wifi_entities_list(
|
|||
def profile_entities_list(
|
||||
router: FritzBoxTools,
|
||||
data_fritz: FritzData,
|
||||
pref_disable_new_entities: bool,
|
||||
) -> list[FritzBoxProfileSwitch]:
|
||||
"""Add new tracker entities from the router."""
|
||||
|
||||
|
@ -291,7 +290,7 @@ def profile_entities_list(
|
|||
|
||||
for mac, device in router.devices.items():
|
||||
if device_filter_out_from_trackers(
|
||||
mac, device, pref_disable_new_entities, data_fritz.profile_switches.values()
|
||||
mac, device, data_fritz.profile_switches.values()
|
||||
):
|
||||
continue
|
||||
|
||||
|
@ -306,14 +305,13 @@ def all_entities_list(
|
|||
device_friendly_name: str,
|
||||
data_fritz: FritzData,
|
||||
local_ip: str,
|
||||
pref_disable_new_entities: bool,
|
||||
) -> list[Entity]:
|
||||
"""Get a list of all entities."""
|
||||
return [
|
||||
*deflection_entities_list(fritzbox_tools, device_friendly_name),
|
||||
*port_entities_list(fritzbox_tools, device_friendly_name, local_ip),
|
||||
*wifi_entities_list(fritzbox_tools, device_friendly_name),
|
||||
*profile_entities_list(fritzbox_tools, data_fritz, pref_disable_new_entities),
|
||||
*profile_entities_list(fritzbox_tools, data_fritz),
|
||||
]
|
||||
|
||||
|
||||
|
@ -337,7 +335,6 @@ async def async_setup_entry(
|
|||
entry.title,
|
||||
data_fritz,
|
||||
local_ip,
|
||||
entry.pref_disable_new_entities,
|
||||
)
|
||||
|
||||
async_add_entities(entities_list)
|
||||
|
@ -345,11 +342,7 @@ async def async_setup_entry(
|
|||
@callback
|
||||
def update_router() -> None:
|
||||
"""Update the values of the router."""
|
||||
async_add_entities(
|
||||
profile_entities_list(
|
||||
fritzbox_tools, data_fritz, entry.pref_disable_new_entities
|
||||
)
|
||||
)
|
||||
async_add_entities(profile_entities_list(fritzbox_tools, data_fritz))
|
||||
|
||||
entry.async_on_unload(
|
||||
async_dispatcher_connect(hass, fritzbox_tools.signal_device_new, update_router)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue