Skip to content

Commit

Permalink
Logging issue workaround for fritzconnection library (#60448)
Browse files Browse the repository at this point in the history
* Logging issue workaround

* Better approach
  • Loading branch information
chemelli74 committed Nov 27, 2021
1 parent bb99d07 commit 3cd80b9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions homeassistant/components/fritz/__init__.py
Expand Up @@ -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 (
Expand All @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/fritz/manifest.json
Expand Up @@ -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"],
Expand Down
8 changes: 8 additions & 0 deletions homeassistant/components/fritzbox_callmonitor/__init__.py
Expand Up @@ -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
Expand All @@ -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."""
Expand Down
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Expand Up @@ -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
Expand Down

0 comments on commit 3cd80b9

Please sign in to comment.