From 2ec0d8e8efed89c7b9b84b6750e805c8b13ad8bb Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Tue, 17 Sep 2024 16:14:59 +0200 Subject: [PATCH] Use debug/warning instead of info log level in components [m] (#126074) * Use debug instead of info log level in components [m] * Fix modbus test --- homeassistant/components/mediaroom/media_player.py | 2 +- homeassistant/components/minio/__init__.py | 6 +++--- homeassistant/components/minio/minio_helper.py | 4 ++-- homeassistant/components/modbus/__init__.py | 2 +- homeassistant/components/modbus/modbus.py | 2 +- homeassistant/components/monoprice/media_player.py | 2 +- homeassistant/components/mysensors/__init__.py | 2 +- homeassistant/components/mysensors/gateway.py | 4 ++-- homeassistant/components/mystrom/binary_sensor.py | 2 +- tests/components/modbus/test_init.py | 6 +++--- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/mediaroom/media_player.py b/homeassistant/components/mediaroom/media_player.py index 8e60609fbac..97b61da437a 100644 --- a/homeassistant/components/mediaroom/media_player.py +++ b/homeassistant/components/mediaroom/media_player.py @@ -149,7 +149,7 @@ class MediaroomDevice(MediaPlayerEntity): self.host = host self.stb = Remote(host) - _LOGGER.info( + _LOGGER.debug( "Found STB at %s%s", host, " - I'm optimistic" if optimistic else "" ) self._channel = None diff --git a/homeassistant/components/minio/__init__.py b/homeassistant/components/minio/__init__.py index e5470cc3313..8a301ea4225 100644 --- a/homeassistant/components/minio/__init__.py +++ b/homeassistant/components/minio/__init__.py @@ -181,7 +181,7 @@ class QueueListener(threading.Thread): def run(self): """Listen to queue events, and forward them to Home Assistant event bus.""" - _LOGGER.info("Running QueueListener") + _LOGGER.debug("Running QueueListener") while True: if (event := self._queue.get()) is None: break @@ -203,10 +203,10 @@ class QueueListener(threading.Thread): def stop(self): """Stop run by putting None into queue and join the thread.""" - _LOGGER.info("Stopping QueueListener") + _LOGGER.debug("Stopping QueueListener") self._queue.put(None) self.join() - _LOGGER.info("Stopped QueueListener") + _LOGGER.debug("Stopped QueueListener") def start_handler(self, _): """Start handler helper method.""" diff --git a/homeassistant/components/minio/minio_helper.py b/homeassistant/components/minio/minio_helper.py index bd814bdf349..6b0021406f7 100644 --- a/homeassistant/components/minio/minio_helper.py +++ b/homeassistant/components/minio/minio_helper.py @@ -116,7 +116,7 @@ class MinioEventThread(threading.Thread): def run(self): """Create MinioClient and run the loop.""" - _LOGGER.info("Running MinioEventThread") + _LOGGER.debug("Running MinioEventThread") self._should_stop = False @@ -125,7 +125,7 @@ class MinioEventThread(threading.Thread): ) while not self._should_stop: - _LOGGER.info("Connecting to minio event stream") + _LOGGER.debug("Connecting to minio event stream") response = None try: response = get_minio_notification_response( diff --git a/homeassistant/components/modbus/__init__.py b/homeassistant/components/modbus/__init__.py index f5efe03dad4..64a9e71b3fc 100644 --- a/homeassistant/components/modbus/__init__.py +++ b/homeassistant/components/modbus/__init__.py @@ -464,7 +464,7 @@ async def async_reset_platform(hass: HomeAssistant, integration_name: str) -> No if DOMAIN not in hass.data: _LOGGER.error("Modbus cannot reload, because it was never loaded") return - _LOGGER.info("Modbus reloading") + _LOGGER.debug("Modbus reloading") hubs = hass.data[DOMAIN] for name in hubs: await hubs[name].async_close() diff --git a/homeassistant/components/modbus/modbus.py b/homeassistant/components/modbus/modbus.py index e70b9de50f0..cc70a783234 100644 --- a/homeassistant/components/modbus/modbus.py +++ b/homeassistant/components/modbus/modbus.py @@ -341,7 +341,7 @@ class ModbusHub: self._log_error(err, error_state=False) return message = f"modbus {self.name} communication open" - _LOGGER.info(message) + _LOGGER.warning(message) async def async_setup(self) -> bool: """Set up pymodbus client.""" diff --git a/homeassistant/components/monoprice/media_player.py b/homeassistant/components/monoprice/media_player.py index daf13b4d7b8..2dde0832440 100644 --- a/homeassistant/components/monoprice/media_player.py +++ b/homeassistant/components/monoprice/media_player.py @@ -71,7 +71,7 @@ async def async_setup_entry( for i in range(1, 4): for j in range(1, 7): zone_id = (i * 10) + j - _LOGGER.info("Adding zone %d for port %s", zone_id, port) + _LOGGER.debug("Adding zone %d for port %s", zone_id, port) entities.append( MonopriceZone(monoprice, sources, config_entry.entry_id, zone_id) ) diff --git a/homeassistant/components/mysensors/__init__.py b/homeassistant/components/mysensors/__init__.py index ce01f139dab..19dcce78446 100644 --- a/homeassistant/components/mysensors/__init__.py +++ b/homeassistant/components/mysensors/__init__.py @@ -148,7 +148,7 @@ def setup_mysensors_platform( devices[dev_id] = device_class_copy(*args_copy) new_devices.append(devices[dev_id]) if new_devices: - _LOGGER.info("Adding new devices: %s", new_devices) + _LOGGER.debug("Adding new devices: %s", new_devices) if async_add_entities is not None: async_add_entities(new_devices) return new_devices diff --git a/homeassistant/components/mysensors/gateway.py b/homeassistant/components/mysensors/gateway.py index 00c8d5eecfb..fa3464c0088 100644 --- a/homeassistant/components/mysensors/gateway.py +++ b/homeassistant/components/mysensors/gateway.py @@ -114,14 +114,14 @@ async def try_connect( await gateway_ready.wait() return True except TimeoutError: - _LOGGER.info("Try gateway connect failed with timeout") + _LOGGER.warning("Try gateway connect failed with timeout") return False finally: if connect_task is not None and not connect_task.done(): connect_task.cancel() await gateway.stop() except OSError as err: - _LOGGER.info("Try gateway connect failed with exception", exc_info=err) + _LOGGER.warning("Try gateway connect failed with exception", exc_info=err) return False diff --git a/homeassistant/components/mystrom/binary_sensor.py b/homeassistant/components/mystrom/binary_sensor.py index c63ab4e5f3b..16772fc7073 100644 --- a/homeassistant/components/mystrom/binary_sensor.py +++ b/homeassistant/components/mystrom/binary_sensor.py @@ -60,7 +60,7 @@ class MyStromView(HomeAssistantView): button_id = data[button_action] entity_id = f"{BINARY_SENSOR_DOMAIN}.{button_id}_{button_action}" if entity_id not in self.buttons: - _LOGGER.info( + _LOGGER.debug( "New myStrom button/action detected: %s/%s", button_id, button_action ) self.buttons[entity_id] = MyStromBinarySensor( diff --git a/tests/components/modbus/test_init.py b/tests/components/modbus/test_init.py index d4dc5b05fac..70230e7d326 100644 --- a/tests/components/modbus/test_init.py +++ b/tests/components/modbus/test_init.py @@ -1168,7 +1168,7 @@ async def test_stop_restart( ) -> None: """Run test for service stop.""" - caplog.set_level(logging.INFO) + caplog.set_level(logging.WARNING) entity_id = f"{SENSOR_DOMAIN}.{TEST_ENTITY_NAME}".replace(" ", "_") assert hass.states.get(entity_id).state in (STATE_UNKNOWN, STATE_UNAVAILABLE) hass.states.async_set(entity_id, 17) @@ -1234,7 +1234,7 @@ async def test_integration_reload( ) -> None: """Run test for integration reload.""" - caplog.set_level(logging.INFO) + caplog.set_level(logging.DEBUG) caplog.clear() yaml_path = get_fixture_path("configuration.yaml", "modbus") @@ -1253,7 +1253,7 @@ async def test_integration_reload_failed( hass: HomeAssistant, caplog: pytest.LogCaptureFixture, mock_modbus ) -> None: """Run test for integration connect failure on reload.""" - caplog.set_level(logging.INFO) + caplog.set_level(logging.DEBUG) caplog.clear() yaml_path = get_fixture_path("configuration.yaml", "modbus")