From b32f40c0fe89f74274a3ac3863b182ce5e73f973 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Mon, 16 Sep 2024 11:44:14 +0200 Subject: [PATCH] Use debug/warning instead of info log level in components [h] (#126033) --- homeassistant/components/harmony/__init__.py | 2 +- homeassistant/components/hdmi_cec/__init__.py | 6 +++--- homeassistant/components/hdmi_cec/switch.py | 2 +- homeassistant/components/hitron_coda/device_tracker.py | 7 +++---- homeassistant/components/homekit/__init__.py | 2 +- homeassistant/components/homekit/type_cameras.py | 6 +++--- homeassistant/components/homekit/type_covers.py | 2 +- homeassistant/components/homekit_controller/connection.py | 6 +++--- .../components/homematicip_cloud/alarm_control_panel.py | 1 - homeassistant/components/homematicip_cloud/config_flow.py | 8 ++++---- .../components/homematicip_cloud/generic_entity.py | 1 - homeassistant/components/homematicip_cloud/hap.py | 4 ++-- homeassistant/components/horizon/media_player.py | 2 +- homeassistant/components/huawei_lte/__init__.py | 8 ++++---- 14 files changed, 27 insertions(+), 30 deletions(-) diff --git a/homeassistant/components/harmony/__init__.py b/homeassistant/components/harmony/__init__.py index 12f7d903f0d..9a643815385 100644 --- a/homeassistant/components/harmony/__init__.py +++ b/homeassistant/components/harmony/__init__.py @@ -59,7 +59,7 @@ async def _migrate_old_unique_ids( activity_id = names_to_ids.get(activity_name) if activity_id is not None: - _LOGGER.info( + _LOGGER.debug( "Migrating unique_id from [%s] to [%s]", entity_entry.unique_id, activity_id, diff --git a/homeassistant/components/hdmi_cec/__init__.py b/homeassistant/components/hdmi_cec/__init__.py index 43a649ba01a..9d208b3a228 100644 --- a/homeassistant/components/hdmi_cec/__init__.py +++ b/homeassistant/components/hdmi_cec/__init__.py @@ -210,7 +210,7 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: # noqa: C901 _LOGGER.debug("Reached _adapter_watchdog") event.call_later(hass, WATCHDOG_INTERVAL, _adapter_watchdog_job) if not adapter.initialized: - _LOGGER.info("Adapter not initialized; Trying to restart") + _LOGGER.warning("Adapter not initialized; Trying to restart") hass.bus.fire(EVENT_HDMI_CEC_UNAVAILABLE) adapter.init() @@ -240,7 +240,7 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: # noqa: C901 KeyPressCommand(mute_key_mapping[att], dst=ADDR_AUDIOSYSTEM) ) hdmi_network.send_command(KeyReleaseCommand(dst=ADDR_AUDIOSYSTEM)) - _LOGGER.info("Audio muted") + _LOGGER.debug("Audio muted") else: _LOGGER.warning("Unknown command %s", cmd) @@ -307,7 +307,7 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: # noqa: C901 if not isinstance(addr, (PhysicalAddress,)): addr = PhysicalAddress(addr) hdmi_network.active_source(addr) - _LOGGER.info("Selected %s (%s)", call.data[ATTR_DEVICE], addr) + _LOGGER.debug("Selected %s (%s)", call.data[ATTR_DEVICE], addr) def _update(call: ServiceCall) -> None: """Update if device update is needed. diff --git a/homeassistant/components/hdmi_cec/switch.py b/homeassistant/components/hdmi_cec/switch.py index 280ea20413b..95998f44a9a 100644 --- a/homeassistant/components/hdmi_cec/switch.py +++ b/homeassistant/components/hdmi_cec/switch.py @@ -27,7 +27,7 @@ def setup_platform( ) -> None: """Find and return HDMI devices as switches.""" if discovery_info and ATTR_NEW in discovery_info: - _LOGGER.info("Setting up HDMI devices %s", discovery_info[ATTR_NEW]) + _LOGGER.debug("Setting up HDMI devices %s", discovery_info[ATTR_NEW]) entities = [] for device in discovery_info[ATTR_NEW]: hdmi_device = hass.data[DOMAIN][device] diff --git a/homeassistant/components/hitron_coda/device_tracker.py b/homeassistant/components/hitron_coda/device_tracker.py index af1c17689c7..2126f5834ce 100644 --- a/homeassistant/components/hitron_coda/device_tracker.py +++ b/homeassistant/components/hitron_coda/device_tracker.py @@ -66,7 +66,6 @@ class HitronCODADeviceScanner(DeviceScanner): self._userid = None self.success_init = self._update_info() - _LOGGER.info("Scanner initialized") def scan_devices(self): """Scan for new devices and return a list with found device IDs.""" @@ -82,7 +81,7 @@ class HitronCODADeviceScanner(DeviceScanner): def _login(self): """Log in to the router. This is required for subsequent api calls.""" - _LOGGER.info("Logging in to CODA") + _LOGGER.debug("Logging in to CODA") try: data = [("user", self._username), (self._type, self._password)] @@ -102,7 +101,7 @@ class HitronCODADeviceScanner(DeviceScanner): def _update_info(self): """Get ARP from router.""" - _LOGGER.info("Fetching") + _LOGGER.debug("Fetching") if self._userid is None and not self._login(): _LOGGER.error("Could not obtain a user ID from the router") @@ -137,5 +136,5 @@ class HitronCODADeviceScanner(DeviceScanner): self.last_results = last_results - _LOGGER.info("Request successful") + _LOGGER.debug("Request successful") return True diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 3f633c2ec59..2fec1382766 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -409,7 +409,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: HomeKitConfigEntry) -> break if not logged_shutdown_wait: - _LOGGER.info("Waiting for the HomeKit server to shutdown") + _LOGGER.debug("Waiting for the HomeKit server to shutdown") logged_shutdown_wait = True await asyncio.sleep(PORT_CLEANUP_CHECK_INTERVAL_SECS) diff --git a/homeassistant/components/homekit/type_cameras.py b/homeassistant/components/homekit/type_cameras.py index 3851bb43541..13169c877a9 100644 --- a/homeassistant/components/homekit/type_cameras.py +++ b/homeassistant/components/homekit/type_cameras.py @@ -453,7 +453,7 @@ class Camera(HomeAccessory, PyhapCamera): # type: ignore[misc] _LOGGER.error("Failed to open ffmpeg stream") return False - _LOGGER.info( + _LOGGER.debug( "[%s] Started stream process - PID %d", session_info["id"], stream.process.pid, @@ -528,11 +528,11 @@ class Camera(HomeAccessory, PyhapCamera): # type: ignore[misc] self._async_stop_ffmpeg_watch(session_id) if not pid_is_alive(stream.process.pid): - _LOGGER.info("[%s] Stream already stopped", session_id) + _LOGGER.warning("[%s] Stream already stopped", session_id) return for shutdown_method in ("close", "kill"): - _LOGGER.info("[%s] %s stream", session_id, shutdown_method) + _LOGGER.debug("[%s] %s stream", session_id, shutdown_method) try: await getattr(stream, shutdown_method)() except Exception: diff --git a/homeassistant/components/homekit/type_covers.py b/homeassistant/components/homekit/type_covers.py index b2f8bc1f01a..855c3b71cc4 100644 --- a/homeassistant/components/homekit/type_covers.py +++ b/homeassistant/components/homekit/type_covers.py @@ -253,7 +253,7 @@ class OpeningDeviceBase(HomeAccessory): def set_tilt(self, value: float) -> None: """Set tilt to value if call came from HomeKit.""" - _LOGGER.info("%s: Set tilt to %d", self.entity_id, value) + _LOGGER.debug("%s: Set tilt to %d", self.entity_id, value) # HomeKit sends values between -90 and 90. # We'll have to normalize to [0,100] diff --git a/homeassistant/components/homekit_controller/connection.py b/homeassistant/components/homekit_controller/connection.py index 02bcd4265cb..52f22bcc9f4 100644 --- a/homeassistant/components/homekit_controller/connection.py +++ b/homeassistant/components/homekit_controller/connection.py @@ -433,7 +433,7 @@ class HKDevice: continue if self.config_entry.entry_id not in device.config_entries: - _LOGGER.info( + _LOGGER.warning( ( "Found candidate device for %s:aid:%s, but owned by a different" " config entry, skipping" @@ -443,7 +443,7 @@ class HKDevice: ) continue - _LOGGER.info( + _LOGGER.debug( "Migrating device identifiers for %s:aid:%s", self.unique_id, accessory.aid, @@ -904,7 +904,7 @@ class HKDevice: return if self._polling_lock_warned: - _LOGGER.info( + _LOGGER.warning( ( "HomeKit device no longer detecting back pressure - not" " skipping poll: %s" diff --git a/homeassistant/components/homematicip_cloud/alarm_control_panel.py b/homeassistant/components/homematicip_cloud/alarm_control_panel.py index 1f294a8cade..e1684c34e4e 100644 --- a/homeassistant/components/homematicip_cloud/alarm_control_panel.py +++ b/homeassistant/components/homematicip_cloud/alarm_control_panel.py @@ -52,7 +52,6 @@ class HomematicipAlarmControlPanelEntity(AlarmControlPanelEntity): def __init__(self, hap: HomematicipHAP) -> None: """Initialize the alarm control panel.""" self._home: AsyncHome = hap.home - _LOGGER.info("Setting up %s", self.name) @property def device_info(self) -> DeviceInfo: diff --git a/homeassistant/components/homematicip_cloud/config_flow.py b/homeassistant/components/homematicip_cloud/config_flow.py index a8b17a80aff..9a9e1cb6778 100644 --- a/homeassistant/components/homematicip_cloud/config_flow.py +++ b/homeassistant/components/homematicip_cloud/config_flow.py @@ -43,10 +43,10 @@ class HomematicipCloudFlowHandler(ConfigFlow, domain=DOMAIN): self.auth = HomematicipAuth(self.hass, user_input) connected = await self.auth.async_setup() if connected: - _LOGGER.info("Connection to HomematicIP Cloud established") + _LOGGER.debug("Connection to HomematicIP Cloud established") return await self.async_step_link() - _LOGGER.info("Connection to HomematicIP Cloud failed") + _LOGGER.debug("Connection to HomematicIP Cloud failed") errors["base"] = "invalid_sgtin_or_pin" return self.async_show_form( @@ -69,7 +69,7 @@ class HomematicipCloudFlowHandler(ConfigFlow, domain=DOMAIN): if pressed: authtoken = await self.auth.async_register() if authtoken: - _LOGGER.info("Write config entry for HomematicIP Cloud") + _LOGGER.debug("Write config entry for HomematicIP Cloud") return self.async_create_entry( title=self.auth.config[HMIPC_HAPID], data={ @@ -92,7 +92,7 @@ class HomematicipCloudFlowHandler(ConfigFlow, domain=DOMAIN): await self.async_set_unique_id(hapid) self._abort_if_unique_id_configured() - _LOGGER.info("Imported authentication for %s", hapid) + _LOGGER.debug("Imported authentication for %s", hapid) return self.async_create_entry( title=hapid, data={HMIPC_AUTHTOKEN: authtoken, HMIPC_HAPID: hapid, HMIPC_NAME: name}, diff --git a/homeassistant/components/homematicip_cloud/generic_entity.py b/homeassistant/components/homematicip_cloud/generic_entity.py index 163f3eec75e..276177420ed 100644 --- a/homeassistant/components/homematicip_cloud/generic_entity.py +++ b/homeassistant/components/homematicip_cloud/generic_entity.py @@ -95,7 +95,6 @@ class HomematicipGenericEntity(Entity): self.functional_channel = self.get_current_channel() # Marker showing that the HmIP device hase been removed. self.hmip_device_removed = False - _LOGGER.info("Setting up %s (%s)", self.name, self._device.modelType) @property def device_info(self) -> DeviceInfo | None: diff --git a/homeassistant/components/homematicip_cloud/hap.py b/homeassistant/components/homematicip_cloud/hap.py index 2384426dc82..db7fcb348c8 100644 --- a/homeassistant/components/homematicip_cloud/hap.py +++ b/homeassistant/components/homematicip_cloud/hap.py @@ -104,7 +104,7 @@ class HomematicipHAP: _LOGGER.error("Error connecting with HomematicIP Cloud: %s", err) return False - _LOGGER.info( + _LOGGER.debug( "Connected to HomematicIP with HAP %s", self.config_entry.unique_id ) @@ -220,7 +220,7 @@ class HomematicipHAP: if self._retry_task is not None: self._retry_task.cancel() await self.home.disable_events() - _LOGGER.info("Closed connection to HomematicIP cloud server") + _LOGGER.debug("Closed connection to HomematicIP cloud server") await self.hass.config_entries.async_unload_platforms( self.config_entry, PLATFORMS ) diff --git a/homeassistant/components/horizon/media_player.py b/homeassistant/components/horizon/media_player.py index 9531f9c0ed7..ba3ca5e2e35 100644 --- a/homeassistant/components/horizon/media_player.py +++ b/homeassistant/components/horizon/media_player.py @@ -65,7 +65,7 @@ def setup_platform( _LOGGER.error("Connection to %s at %s failed: %s", name, host, msg) raise PlatformNotReady from msg - _LOGGER.info("Connection to %s at %s established", name, host) + _LOGGER.debug("Connection to %s at %s established", name, host) add_entities([HorizonDevice(client, name, keys)], True) diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index b0c40c71658..ad72e839534 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -209,7 +209,7 @@ class Router: else: _LOGGER.debug("failed") return - _LOGGER.info( + _LOGGER.warning( "%s requires authorization, excluding from future updates", key ) self.subscriptions.pop(key) @@ -221,7 +221,7 @@ class Router: exc, (ResponseErrorNotSupportedException, ExpatError) ) and exc.code not in (-1, 100006): raise - _LOGGER.info( + _LOGGER.warning( "%s apparently not supported by device, excluding from future updates", key, ) @@ -559,12 +559,12 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> if isinstance(recipient, str): options[CONF_RECIPIENT] = [x.strip() for x in recipient.split(",")] hass.config_entries.async_update_entry(config_entry, options=options, version=2) - _LOGGER.info("Migrated config entry to version %d", config_entry.version) + _LOGGER.debug("Migrated config entry to version %d", config_entry.version) if config_entry.version == 2: data = dict(config_entry.data) data[CONF_MAC] = [] hass.config_entries.async_update_entry(config_entry, data=data, version=3) - _LOGGER.info("Migrated config entry to version %d", config_entry.version) + _LOGGER.debug("Migrated config entry to version %d", config_entry.version) # There can be no longer needed *_from_yaml data and options things left behind # from pre-2022.4ish; they can be removed while at it when/if we eventually bump and # migrate to version > 3 for some other reason.