Improve logging for Fritz switches creation (#67640)

pull/67653/head
Simone Chemelli 2022-03-04 15:49:22 +01:00 committed by GitHub
parent abf4f50515
commit 749a76c4e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -57,6 +57,7 @@ SERVICE_SET_GUEST_WIFI_PW = "set_guest_wifi_password"
SWITCH_TYPE_DEFLECTION = "CallDeflection" SWITCH_TYPE_DEFLECTION = "CallDeflection"
SWITCH_TYPE_PORTFORWARD = "PortForward" SWITCH_TYPE_PORTFORWARD = "PortForward"
SWITCH_TYPE_PROFILE = "Profile"
SWITCH_TYPE_WIFINETWORK = "WiFiNetwork" SWITCH_TYPE_WIFINETWORK = "WiFiNetwork"
UPTIME_DEVIATION = 5 UPTIME_DEVIATION = 5

View File

@ -30,6 +30,7 @@ from .const import (
DOMAIN, DOMAIN,
SWITCH_TYPE_DEFLECTION, SWITCH_TYPE_DEFLECTION,
SWITCH_TYPE_PORTFORWARD, SWITCH_TYPE_PORTFORWARD,
SWITCH_TYPE_PROFILE,
SWITCH_TYPE_WIFINETWORK, SWITCH_TYPE_WIFINETWORK,
WIFI_STANDARD, WIFI_STANDARD,
MeshRoles, MeshRoles,
@ -185,6 +186,7 @@ def profile_entities_list(
data_fritz: FritzData, data_fritz: FritzData,
) -> list[FritzBoxProfileSwitch]: ) -> list[FritzBoxProfileSwitch]:
"""Add new tracker entities from the AVM device.""" """Add new tracker entities from the AVM device."""
_LOGGER.debug("Setting up %s switches", SWITCH_TYPE_PROFILE)
new_profiles: list[FritzBoxProfileSwitch] = [] new_profiles: list[FritzBoxProfileSwitch] = []
@ -198,11 +200,15 @@ def profile_entities_list(
if device_filter_out_from_trackers( if device_filter_out_from_trackers(
mac, device, data_fritz.profile_switches.values() mac, device, data_fritz.profile_switches.values()
): ):
_LOGGER.debug(
"Skipping profile switch creation for device %s", device.hostname
)
continue continue
new_profiles.append(FritzBoxProfileSwitch(avm_wrapper, device)) new_profiles.append(FritzBoxProfileSwitch(avm_wrapper, device))
data_fritz.profile_switches[avm_wrapper.unique_id].add(mac) data_fritz.profile_switches[avm_wrapper.unique_id].add(mac)
_LOGGER.debug("Creating %s profile switches", len(new_profiles))
return new_profiles return new_profiles