Use debug/warning instead of info log level in components [s] (#126141)

* Use debug/warning instead of info log level in components [s]

* Fix merge error
This commit is contained in:
Jan-Philipp Benecke 2024-09-18 21:33:52 +02:00 committed by GitHub
parent d90caf3e86
commit 1d425f3913
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 49 additions and 51 deletions

View file

@ -208,7 +208,7 @@ async def _async_create_bridge_with_updated_data(
"Failed to determine connection method, make sure the device is on."
)
LOGGER.info("Updated port to %s and method to %s for %s", port, method, host)
LOGGER.debug("Updated port to %s and method to %s for %s", port, method, host)
updated_data[CONF_PORT] = port
updated_data[CONF_METHOD] = method
@ -235,21 +235,21 @@ async def _async_create_bridge_with_updated_data(
if mac and mac != "none":
# Samsung sometimes returns a value of "none" for the mac address
# this should be ignored
LOGGER.info("Updated mac to %s for %s", mac, host)
LOGGER.debug("Updated mac to %s for %s", mac, host)
updated_data[CONF_MAC] = dr.format_mac(mac)
else:
LOGGER.info("Failed to get mac for %s", host)
LOGGER.warning("Failed to get mac for %s", host)
if not model:
LOGGER.debug("Attempting to get model for %s", host)
if info:
model = info.get("device", {}).get("modelName")
if model:
LOGGER.info("Updated model to %s for %s", model, host)
LOGGER.debug("Updated model to %s for %s", model, host)
updated_data[CONF_MODEL] = model
if model_requires_encryption(model) and method != METHOD_ENCRYPTED_WEBSOCKET:
LOGGER.info(
LOGGER.warning(
(
"Detected model %s for %s. Some televisions from H and J series use "
"an encrypted protocol but you are using %s which may not be supported"

View file

@ -536,7 +536,7 @@ class SamsungTVWSBridge(
LOGGER.debug("Working config: %s", config)
return RESULT_SUCCESS
except ConnectionClosedError as err:
LOGGER.info(
LOGGER.warning(
(
"Working but unsupported config: %s, error: '%s'; this may be"
" an indication that access to the TV has been denied. Please"
@ -609,7 +609,7 @@ class SamsungTVWSBridge(
try:
await self._remote.start_listening(self._remote_event)
except UnauthorizedError as err:
LOGGER.info(
LOGGER.warning(
"Failed to get remote for %s, re-authentication required: %s",
self.host,
repr(err),
@ -618,7 +618,7 @@ class SamsungTVWSBridge(
self._notify_reauth_callback()
self._remote = None
except ConnectionClosedError as err:
LOGGER.info(
LOGGER.warning(
"Failed to get remote for %s: %s",
self.host,
repr(err),
@ -643,7 +643,7 @@ class SamsungTVWSBridge(
# Initialise device info on first connect
await self.async_device_info()
if self.token != self._remote.token:
LOGGER.info(
LOGGER.warning(
"SamsungTVWSBridge has provided a new token %s",
self._remote.token,
)

View file

@ -93,7 +93,7 @@ class SamsungTVEntity(CoordinatorEntity[SamsungTVDataUpdateCoordinator], Entity)
LOGGER.debug("Attempting to turn on %s via automation", self.entity_id)
await self._turn_on_action.async_run(self.hass, self._context)
elif self._mac:
LOGGER.info(
LOGGER.warning(
"Attempting to turn on %s via Wake-On-Lan; if this does not work, "
"please ensure that Wake-On-Lan is available for your device or use "
"a turn_on automation",

View file

@ -284,7 +284,7 @@ class SamsungTVDevice(SamsungTVEntity, MediaPlayerEntity):
async def _async_launch_app(self, app_id: str) -> None:
"""Send launch_app to the tv."""
if self._bridge.power_off_in_progress:
LOGGER.info("TV is powering off, not sending launch_app command")
LOGGER.debug("TV is powering off, not sending launch_app command")
return
assert isinstance(self._bridge, SamsungTVWSBridge)
await self._bridge.async_launch_app(app_id)
@ -293,7 +293,7 @@ class SamsungTVDevice(SamsungTVEntity, MediaPlayerEntity):
"""Send a key to the tv and handles exceptions."""
assert keys
if self._bridge.power_off_in_progress and keys[0] != "KEY_POWEROFF":
LOGGER.info("TV is powering off, not sending keys: %s", keys)
LOGGER.debug("TV is powering off, not sending keys: %s", keys)
return
await self._bridge.async_send_keys(keys)
@ -304,7 +304,7 @@ class SamsungTVDevice(SamsungTVEntity, MediaPlayerEntity):
async def async_set_volume_level(self, volume: float) -> None:
"""Set volume level on the media player."""
if (dmr_device := self._dmr_device) is None:
LOGGER.info("Upnp services are not available on %s", self._host)
LOGGER.warning("Upnp services are not available on %s", self._host)
return
try:
await dmr_device.async_set_volume_level(volume)

View file

@ -46,7 +46,7 @@ class SamsungTVRemote(SamsungTVEntity, RemoteEntity):
See https://github.com/jaruba/ha-samsungtv-tizen/blob/master/Key_codes.md
"""
if self._bridge.power_off_in_progress:
LOGGER.info("TV is powering off, not sending keys: %s", command)
LOGGER.debug("TV is powering off, not sending keys: %s", command)
return
num_repeats = kwargs[ATTR_NUM_REPEATS]

View file

@ -43,7 +43,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
def stop_monitor(event):
"""Stop the SCSGate."""
_LOGGER.info("Stopping SCSGate monitor thread")
_LOGGER.debug("Stopping SCSGate monitor thread")
scsgate.stop()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_monitor)

View file

@ -196,7 +196,7 @@ class SerialSensor(SensorEntity):
logged_error = True
await self._handle_error()
else:
_LOGGER.info("Serial device %s connected", device)
_LOGGER.debug("Serial device %s connected", device)
while True:
try:
line = await reader.readline()

View file

@ -157,7 +157,7 @@ class SighthoundEntity(ImageProcessingEntity):
if self._save_timestamped_file:
timestamp_save_path = directory / f"{self._name}_{self._last_detection}.jpg"
img.save(timestamp_save_path)
_LOGGER.info("Sighthound saved file %s", timestamp_save_path)
_LOGGER.debug("Sighthound saved file %s", timestamp_save_path)
@property
def camera_entity(self):

View file

@ -504,7 +504,7 @@ class SimpliSafe:
except Exception as err: # noqa: BLE001
LOGGER.error("Unknown exception while connecting to websocket: %s", err)
LOGGER.info("Reconnecting to websocket")
LOGGER.warning("Reconnecting to websocket")
await self._async_cancel_websocket_loop()
self._websocket_reconnect_task = self._hass.async_create_task(
self._async_start_websocket_loop()
@ -604,7 +604,7 @@ class SimpliSafe:
@callback
def async_save_refresh_token(token: str) -> None:
"""Save a refresh token to the config entry."""
LOGGER.info("Saving new refresh token to HASS storage")
LOGGER.debug("Saving new refresh token to HASS storage")
self._hass.config_entries.async_update_entry(
self.entry,
data={**self.entry.data, CONF_TOKEN: token},
@ -647,7 +647,7 @@ class SimpliSafe:
# In case the user attempts an action not allowed in their current plan,
# we merely log that message at INFO level (so the user is aware,
# but not spammed with ERROR messages that they cannot change):
LOGGER.info(result)
LOGGER.debug(result)
if isinstance(result, SimplipyError):
raise UpdateFailed(f"SimpliSafe error while updating: {result}")

View file

@ -63,7 +63,7 @@ async def async_setup_entry(
for system in simplisafe.systems.values():
if system.version == 2:
LOGGER.info("Skipping sensor setup for V2 system: %s", system.system_id)
LOGGER.warning("Skipping sensor setup for V2 system: %s", system.system_id)
continue
for sensor in system.sensors.values():

View file

@ -38,7 +38,7 @@ async def async_setup_entry(
for system in simplisafe.systems.values():
if system.version == 2:
LOGGER.info("Skipping lock setup for V2 system: %s", system.system_id)
LOGGER.warning("Skipping lock setup for V2 system: %s", system.system_id)
continue
locks.extend(

View file

@ -29,7 +29,7 @@ async def async_setup_entry(
for system in simplisafe.systems.values():
if system.version == 2:
LOGGER.info("Skipping sensor setup for V2 system: %s", system.system_id)
LOGGER.warning("Skipping sensor setup for V2 system: %s", system.system_id)
continue
sensors.extend(

View file

@ -69,7 +69,7 @@ def setup_platform(
def monitor_stop(_service_or_event):
"""Stop the monitor thread."""
_LOGGER.info("Stopping monitor for %s", name)
_LOGGER.debug("Stopping monitor for %s", name)
mon.terminate()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, monitor_stop)
@ -163,7 +163,7 @@ class Monitor(threading.Thread, SensorEntity):
# Magic: writing this makes device happy
device.char_write_handle(0x1B, bytearray([255]), False)
device.subscribe(BLE_TEMP_UUID, self._update)
_LOGGER.info("Subscribed to %s", self.name)
_LOGGER.debug("Subscribed to %s", self.name)
while self.keep_going:
# protect against stale connections, just read temperature
device.char_read(BLE_TEMP_UUID, timeout=CONNECT_TIMEOUT)

View file

@ -128,7 +128,7 @@ class Gateway:
except gammu.ERR_EMPTY:
# error is raised if memory is empty (this induces wrong reported
# memory status)
_LOGGER.info("Failed to read messages!")
_LOGGER.warning("Failed to read messages!")
# Link all SMS when there are concatenated messages
return gammu.LinkSMS(entries)

View file

@ -115,7 +115,7 @@ class HomeAssistantSnapcast:
client.set_availability(True)
for group in self.groups:
group.set_availability(True)
_LOGGER.info("Server connected: %s", self.hpid)
_LOGGER.debug("Server connected: %s", self.hpid)
self.on_update()
def on_disconnect(self, ex: Exception | None) -> None:

View file

@ -93,7 +93,7 @@ class SolarEdgeOverviewDataService(SolarEdgeDataService):
for index, key in enumerate(energy_keys, start=1):
# All coming values in list should be larger than the current value.
if any(self.data[k] > self.data[key] for k in energy_keys[index:]):
LOGGER.info(
LOGGER.warning(
"Ignoring invalid energy value %s for %s", self.data[key], key
)
self.data.pop(key)

View file

@ -50,7 +50,7 @@ class SomaFlowHandler(ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="connection_error")
try:
result = await self.hass.async_add_executor_job(api.list_devices)
_LOGGER.info("Successfully set up Soma Connect")
_LOGGER.debug("Successfully set up Soma Connect")
if result["result"] == "success":
return self.async_create_entry(
title="Soma Connect",

View file

@ -52,7 +52,7 @@ async def async_setup_entry(
cover_list.append(SomfyShade(somfy_mylink, **cover_config))
_LOGGER.info(
_LOGGER.debug(
"Adding Somfy Cover: %s with targetID %s",
cover_config["name"],
cover_config["target_id"],

View file

@ -107,7 +107,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
}
hass.config_entries.async_update_entry(entry, data=data, version=2)
LOGGER.info("Migration to version %s successful", entry.version)
LOGGER.debug("Migration to version %s successful", entry.version)
return True

View file

@ -167,7 +167,7 @@ class SongpalEntity(MediaPlayerEntity):
async def async_activate_websocket(self):
"""Activate websocket for listening if wanted."""
_LOGGER.info("Activating websocket connection")
_LOGGER.debug("Activating websocket connection")
async def _volume_changed(volume: VolumeChange):
_LOGGER.debug("Volume changed: %s", volume)

View file

@ -413,7 +413,7 @@ class SonosDiscoveryManager:
continue
if self.hosts_in_error.pop(ip_addr, None):
_LOGGER.info("Connection reestablished to Sonos device %s", ip_addr)
_LOGGER.warning("Connection reestablished to Sonos device %s", ip_addr)
# Each speaker has the topology for other online speakers, so add them in here if they were not
# configured. The metadata is already in Soco for these.
if new_hosts := {

View file

@ -289,7 +289,7 @@ class SoundTouchMediaPlayer(MediaPlayerEntity):
if not slaves:
_LOGGER.warning("Unable to create zone without slaves")
else:
_LOGGER.info("Creating zone with master %s", self._device.config.name)
_LOGGER.debug("Creating zone with master %s", self._device.config.name)
self._device.create_zone([slave.device for slave in slaves])
def remove_zone_slave(self, slaves):
@ -305,7 +305,7 @@ class SoundTouchMediaPlayer(MediaPlayerEntity):
if not slaves:
_LOGGER.warning("Unable to find slaves to remove")
else:
_LOGGER.info(
_LOGGER.debug(
"Removing slaves from zone with master %s", self._device.config.name
)
# SoundTouch API seems to have a bug and won't remove slaves if there are
@ -327,7 +327,7 @@ class SoundTouchMediaPlayer(MediaPlayerEntity):
if not slaves:
_LOGGER.warning("Unable to find slaves to add")
else:
_LOGGER.info(
_LOGGER.debug(
"Adding slaves to zone with master %s", self._device.config.name
)
self._device.add_zone_slave([slave.device for slave in slaves])

View file

@ -70,7 +70,7 @@ class SwisscomDeviceScanner(DeviceScanner):
if not self.success_init:
return False
_LOGGER.info("Loading data from Swisscom Internet Box")
_LOGGER.debug("Loading data from Swisscom Internet Box")
if not (data := self.get_swisscom_data()):
return False
@ -95,11 +95,11 @@ class SwisscomDeviceScanner(DeviceScanner):
requests.exceptions.Timeout,
requests.exceptions.ConnectTimeout,
):
_LOGGER.info("No response from Swisscom Internet Box")
_LOGGER.debug("No response from Swisscom Internet Box")
return devices
if "status" not in request.json():
_LOGGER.info("No status in response from Swisscom Internet Box")
_LOGGER.debug("No status in response from Swisscom Internet Box")
return devices
for device in request.json()["status"]:

View file

@ -115,7 +115,7 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
rf"(?:{old_unique_id})-(?P<id>\d+)", entity_entry.unique_id
):
entity_new_unique_id = f'{new_unique_id}-{match.group("id")}'
_LOGGER.info(
_LOGGER.debug(
"Migrating entity %s from %s to new id %s",
entity_entry.entity_id,
entity_entry.unique_id,
@ -141,7 +141,7 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
f"{match.group('id')}-{new_unique_id}",
)
}
_LOGGER.info(
_LOGGER.debug(
"Migrating device %s identifiers from %s to %s",
device_entry.name,
device_entry.identifiers,
@ -158,6 +158,6 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
hass.config_entries.async_update_entry(config_entry, version=2)
_LOGGER.info("Migration to version %s successful", config_entry.version)
_LOGGER.debug("Migration to version %s successful", config_entry.version)
return True

View file

@ -88,7 +88,7 @@ class SwitchBeeDeviceEntity[_DeviceTypeT: SwitchBeeBaseDevice](
def _check_if_became_online(self) -> None:
"""Check if the device was offline (now online) and bring it back."""
if not self._is_online:
_LOGGER.info(
_LOGGER.warning(
"%s device is now responding",
self.name,
)

View file

@ -124,7 +124,7 @@ class SyncthingClient:
while True:
if await self._server_available():
if server_was_unavailable:
_LOGGER.info(
_LOGGER.warning(
"The syncthing server '%s' is back online", self._client.url
)
async_dispatcher_send(
@ -153,7 +153,7 @@ class SyncthingClient:
event,
)
except aiosyncthing.exceptions.SyncthingError:
_LOGGER.info(
_LOGGER.warning(
(
"The syncthing server '%s' is not available. Sleeping %i"
" seconds and retrying"

View file

@ -37,7 +37,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await printer.update()
except SyncThruAPINotSupported as api_error:
# if an exception is thrown, printer does not support syncthru
_LOGGER.info(
_LOGGER.debug(
"Configured printer at %s does not provide SyncThru JSON API",
printer.url,
exc_info=api_error,

View file

@ -138,7 +138,7 @@ class SynoApi:
except SYNOLOGY_CONNECTION_EXCEPTIONS:
self._with_surveillance_station = False
self.dsm.reset(SynoSurveillanceStation.API_KEY)
LOGGER.info(
LOGGER.warning(
"Surveillance Station found, but disabled due to missing user"
" permissions"
)

View file

@ -289,7 +289,7 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
and existing_entry.data[CONF_HOST] != host
and ip(existing_entry.data[CONF_HOST]).version == ip(host).version
):
_LOGGER.info(
_LOGGER.debug(
"Update host from '%s' to '%s' for NAS '%s' via discovery",
existing_entry.data[CONF_HOST],
host,

View file

@ -100,8 +100,6 @@ class SynologySrmDeviceScanner(DeviceScanner):
self.devices = []
self.success_init = self._update_info()
_LOGGER.info("Synology SRM scanner initialized")
def scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
self._update_info()

View file

@ -138,7 +138,7 @@ async def test_async_poll_manual_hosts_warnings(
await manager.async_poll_manual_hosts()
assert len(caplog.messages) == 1
record = caplog.records[0]
assert record.levelname == "INFO"
assert record.levelname == "WARNING"
assert "Connection reestablished to Sonos device" in record.message
assert mock_async_call_later.call_count == 3