Use debug/warning/error instead of info log level in components [x] (#126232)

This commit is contained in:
Jan-Philipp Benecke 2024-09-18 21:34:11 +02:00 committed by GitHub
parent 1d425f3913
commit 8338075d03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 21 additions and 17 deletions

View File

@ -54,7 +54,7 @@ def setup_platform(
try: try:
x10_command("info") x10_command("info")
except CalledProcessError as err: except CalledProcessError as err:
_LOGGER.info("Assuming that the device is CM17A: %s", err.output) _LOGGER.warning("Assuming that the device is CM17A: %s", err.output)
is_cm11a = False is_cm11a = False
add_entities(X10Light(light, is_cm11a) for light in config[CONF_DEVICES]) add_entities(X10Light(light, is_cm11a) for light in config[CONF_DEVICES])

View File

@ -140,7 +140,7 @@ class XiaomiCamera(Camera):
videos = [v for v in ftp.nlst() if ".tmp" not in v] videos = [v for v in ftp.nlst() if ".tmp" not in v]
if not videos: if not videos:
_LOGGER.info('Video folder "%s" is empty; delaying', latest_dir) _LOGGER.debug('Video folder "%s" is empty; delaying', latest_dir)
return False return False
if self._model == MODEL_XIAOFANG: if self._model == MODEL_XIAOFANG:

View File

@ -139,7 +139,7 @@ def _retrieve_list(host, token, **kwargs):
_LOGGER.exception("No list in response from mi router. %s", result) _LOGGER.exception("No list in response from mi router. %s", result)
return None return None
else: else:
_LOGGER.info( _LOGGER.warning(
"Receive wrong Xiaomi code %s, expected 0 in response %s", "Receive wrong Xiaomi code %s, expected 0 in response %s",
xiaomi_code, xiaomi_code,
result, result,

View File

@ -186,7 +186,9 @@ def _async_update_data_default(hass, device):
except DeviceException as ex: except DeviceException as ex:
if getattr(ex, "code", None) != -9999: if getattr(ex, "code", None) != -9999:
raise UpdateFailed(ex) from ex raise UpdateFailed(ex) from ex
_LOGGER.info("Got exception while fetching the state, trying again: %s", ex) _LOGGER.error(
"Got exception while fetching the state, trying again: %s", ex
)
# Try to fetch the data a second time after error code -9999 # Try to fetch the data a second time after error code -9999
try: try:
return await _async_fetch_data() return await _async_fetch_data()
@ -273,7 +275,9 @@ def _async_update_data_vacuum(
except DeviceException as ex: except DeviceException as ex:
if getattr(ex, "code", None) != -9999: if getattr(ex, "code", None) != -9999:
raise UpdateFailed(ex) from ex raise UpdateFailed(ex) from ex
_LOGGER.info("Got exception while fetching the state, trying again: %s", ex) _LOGGER.error(
"Got exception while fetching the state, trying again: %s", ex
)
# Try to fetch the data a second time after error code -9999 # Try to fetch the data a second time after error code -9999
try: try:

View File

@ -37,12 +37,12 @@ def get_scanner(
host = config[CONF_HOST] host = config[CONF_HOST]
token = config[CONF_TOKEN] token = config[CONF_TOKEN]
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5]) _LOGGER.debug("Initializing with host %s (token %s...)", host, token[:5])
try: try:
device = WifiRepeater(host, token) device = WifiRepeater(host, token)
device_info = device.info() device_info = device.info()
_LOGGER.info( _LOGGER.debug(
"%s %s %s detected", "%s %s %s detected",
device_info.model, device_info.model,
device_info.firmware_version, device_info.firmware_version,

View File

@ -87,7 +87,7 @@ class ConnectXiaomiGateway:
try: try:
self._gateway_device.discover_devices() self._gateway_device.discover_devices()
except DeviceException as error: except DeviceException as error:
_LOGGER.info( _LOGGER.error(
( (
"DeviceException during getting subdevices of xiaomi gateway" "DeviceException during getting subdevices of xiaomi gateway"
" with host %s, trying cloud to obtain subdevices: %s" " with host %s, trying cloud to obtain subdevices: %s"

View File

@ -77,7 +77,7 @@ async def async_setup_platform(
token = config[CONF_TOKEN] token = config[CONF_TOKEN]
# Create handler # Create handler
_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5]) _LOGGER.debug("Initializing with host %s (token %s...)", host, token[:5])
# The Chuang Mi IR Remote Controller wants to be re-discovered every # The Chuang Mi IR Remote Controller wants to be re-discovered every
# 5 minutes. As long as polling is disabled the device should be # 5 minutes. As long as polling is disabled the device should be
@ -89,7 +89,7 @@ async def async_setup_platform(
device_info = await hass.async_add_executor_job(device.info) device_info = await hass.async_add_executor_job(device.info)
model = device_info.model model = device_info.model
unique_id = f"{model}-{device_info.mac_address}" unique_id = f"{model}-{device_info.mac_address}"
_LOGGER.info( _LOGGER.debug(
"%s %s %s detected", "%s %s %s detected",
model, model,
device_info.firmware_version, device_info.firmware_version,

View File

@ -190,13 +190,13 @@ async def async_send_message( # noqa: C901
_LOGGER.debug("Timeout set to %ss", timeout) _LOGGER.debug("Timeout set to %ss", timeout)
url = await self.upload_file(timeout=timeout) url = await self.upload_file(timeout=timeout)
_LOGGER.info("Upload success") _LOGGER.debug("Upload success")
for recipient in recipients: for recipient in recipients:
if room: if room:
_LOGGER.info("Sending file to %s", room) _LOGGER.debug("Sending file to %s", room)
message = self.Message(sto=room, stype="groupchat") message = self.Message(sto=room, stype="groupchat")
else: else:
_LOGGER.info("Sending file to %s", recipient) _LOGGER.debug("Sending file to %s", recipient)
message = self.Message(sto=recipient, stype="chat") message = self.Message(sto=recipient, stype="chat")
message["body"] = url message["body"] = url
message["oob"]["url"] = url message["oob"]["url"] = url
@ -264,7 +264,7 @@ async def async_send_message( # noqa: C901
uploaded via XEP_0363 and HTTP and returns the resulting URL uploaded via XEP_0363 and HTTP and returns the resulting URL
""" """
_LOGGER.info("Getting file from %s", url) _LOGGER.debug("Getting file from %s", url)
def get_url(url): def get_url(url):
"""Return result for GET request to url.""" """Return result for GET request to url."""
@ -295,7 +295,7 @@ async def async_send_message( # noqa: C901
_LOGGER.debug("Got %s extension", extension) _LOGGER.debug("Got %s extension", extension)
filename = self.get_random_filename(None, extension=extension) filename = self.get_random_filename(None, extension=extension)
_LOGGER.info("Uploading file from URL, %s", filename) _LOGGER.debug("Uploading file from URL, %s", filename)
return await self["xep_0363"].upload_file( return await self["xep_0363"].upload_file(
filename, filename,
@ -313,7 +313,7 @@ async def async_send_message( # noqa: C901
async def upload_file_from_path(self, path: str, timeout=None): async def upload_file_from_path(self, path: str, timeout=None):
"""Upload a file from a local file path via XEP_0363.""" """Upload a file from a local file path via XEP_0363."""
_LOGGER.info("Uploading file from path, %s", path) _LOGGER.debug("Uploading file from path, %s", path)
if not hass.config.is_allowed_path(path): if not hass.config.is_allowed_path(path):
raise PermissionError("Could not access file. Path not allowed") raise PermissionError("Could not access file. Path not allowed")
@ -374,6 +374,6 @@ async def async_send_message( # noqa: C901
@staticmethod @staticmethod
def discard_ssl_invalid_cert(event): def discard_ssl_invalid_cert(event):
"""Do nothing if ssl certificate is invalid.""" """Do nothing if ssl certificate is invalid."""
_LOGGER.info("Ignoring invalid SSL certificate as requested") _LOGGER.debug("Ignoring invalid SSL certificate as requested")
SendNotificationBot() SendNotificationBot()