From 3cd80b95db7de6980d10b47b45248420bed3bf60 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Sat, 27 Nov 2021 16:56:53 +0100 Subject: [PATCH] Logging issue workaround for fritzconnection library (#60448) * Logging issue workaround * Better approach --- homeassistant/components/fritz/__init__.py | 8 ++++++++ homeassistant/components/fritz/manifest.json | 2 +- homeassistant/components/fritzbox_callmonitor/__init__.py | 8 ++++++++ .../components/fritzbox_callmonitor/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/fritz/__init__.py b/homeassistant/components/fritz/__init__.py index 6d0030685b27b8..193e11f49f3de8 100644 --- a/homeassistant/components/fritz/__init__.py +++ b/homeassistant/components/fritz/__init__.py @@ -2,6 +2,7 @@ import logging from fritzconnection.core.exceptions import FritzConnectionException, FritzSecurityError +from fritzconnection.core.logger import fritzlogger from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( @@ -20,6 +21,13 @@ _LOGGER = logging.getLogger(__name__) +level = _LOGGER.getEffectiveLevel() +_LOGGER.info( + "Setting logging level of fritzconnection: %s", logging.getLevelName(level) +) +fritzlogger.set_level(level) +fritzlogger.enable() + async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up fritzboxtools from config entry.""" diff --git a/homeassistant/components/fritz/manifest.json b/homeassistant/components/fritz/manifest.json index e6ae95e3eb45e6..219e8f946ae084 100644 --- a/homeassistant/components/fritz/manifest.json +++ b/homeassistant/components/fritz/manifest.json @@ -3,7 +3,7 @@ "name": "AVM FRITZ!Box Tools", "documentation": "https://www.home-assistant.io/integrations/fritz", "requirements": [ - "fritzconnection==1.7.0", + "fritzconnection==1.7.2", "xmltodict==0.12.0" ], "dependencies": ["network"], diff --git a/homeassistant/components/fritzbox_callmonitor/__init__.py b/homeassistant/components/fritzbox_callmonitor/__init__.py index 4c36ee3ddfb071..edf463a84eb581 100644 --- a/homeassistant/components/fritzbox_callmonitor/__init__.py +++ b/homeassistant/components/fritzbox_callmonitor/__init__.py @@ -2,6 +2,7 @@ import logging from fritzconnection.core.exceptions import FritzConnectionException, FritzSecurityError +from fritzconnection.core.logger import fritzlogger from requests.exceptions import ConnectionError as RequestsConnectionError from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME @@ -19,6 +20,13 @@ _LOGGER = logging.getLogger(__name__) +level = _LOGGER.getEffectiveLevel() +_LOGGER.info( + "Setting logging level of fritzconnection: %s", logging.getLevelName(level) +) +fritzlogger.set_level(level) +fritzlogger.enable() + async def async_setup_entry(hass, config_entry): """Set up the fritzbox_callmonitor platforms.""" diff --git a/homeassistant/components/fritzbox_callmonitor/manifest.json b/homeassistant/components/fritzbox_callmonitor/manifest.json index 3d58f27e950d45..91bd73a6efdddb 100644 --- a/homeassistant/components/fritzbox_callmonitor/manifest.json +++ b/homeassistant/components/fritzbox_callmonitor/manifest.json @@ -3,7 +3,7 @@ "name": "AVM FRITZ!Box Call Monitor", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/fritzbox_callmonitor", - "requirements": ["fritzconnection==1.7.0"], + "requirements": ["fritzconnection==1.7.2"], "codeowners": [], "iot_class": "local_polling" } diff --git a/requirements_all.txt b/requirements_all.txt index f1cb4d7b98e522..79560d8cb60708 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -680,7 +680,7 @@ freesms==0.2.0 # homeassistant.components.fritz # homeassistant.components.fritzbox_callmonitor -fritzconnection==1.7.0 +fritzconnection==1.7.2 # homeassistant.components.google_translate gTTS==2.2.3 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 79d9e9852fae61..f506655f8d0eca 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -415,7 +415,7 @@ freebox-api==0.0.10 # homeassistant.components.fritz # homeassistant.components.fritzbox_callmonitor -fritzconnection==1.7.0 +fritzconnection==1.7.2 # homeassistant.components.google_translate gTTS==2.2.3