diff --git a/homeassistant/components/mqtt/client.py b/homeassistant/components/mqtt/client.py index 9021e4fa641d5..09edf3f9b340e 100644 --- a/homeassistant/components/mqtt/client.py +++ b/homeassistant/components/mqtt/client.py @@ -921,7 +921,7 @@ def _async_mqtt_on_connect( self.connected = True async_dispatcher_send(self.hass, MQTT_CONNECTED) - _LOGGER.info( + _LOGGER.debug( "Connected to MQTT server %s:%s (%s)", self.conf[CONF_BROKER], self.conf.get(CONF_PORT, DEFAULT_PORT), diff --git a/homeassistant/components/mqtt/discovery.py b/homeassistant/components/mqtt/discovery.py index 702db9e508e1c..4717f297d1654 100644 --- a/homeassistant/components/mqtt/discovery.py +++ b/homeassistant/components/mqtt/discovery.py @@ -123,11 +123,11 @@ def set_discovery_hash(hass: HomeAssistant, discovery_hash: tuple[str, str]) -> @callback def async_log_discovery_origin_info( - message: str, discovery_payload: MQTTDiscoveryPayload + message: str, discovery_payload: MQTTDiscoveryPayload, level: int = logging.INFO ) -> None: """Log information about the discovery and origin.""" if CONF_ORIGIN not in discovery_payload: - _LOGGER.info(message) + _LOGGER.log(level, message) return origin_info: MqttOriginInfo = discovery_payload[CONF_ORIGIN] sw_version_log = "" @@ -136,7 +136,8 @@ def async_log_discovery_origin_info( support_url_log = "" if support_url := origin_info.get("support_url"): support_url_log = f", support URL: {support_url}" - _LOGGER.info( + _LOGGER.log( + level, "%s from external application %s%s%s", message, origin_info["name"], @@ -343,7 +344,7 @@ def discovery_done(_: Any) -> None: elif already_discovered: # Dispatch update message = f"Component has already been discovered: {component} {discovery_id}, sending update" - async_log_discovery_origin_info(message, payload) + async_log_discovery_origin_info(message, payload, logging.DEBUG) async_dispatcher_send( hass, MQTT_DISCOVERY_UPDATED.format(*discovery_hash), payload ) diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index 2a3144a6b1677..173cf9ba08d33 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -817,7 +817,7 @@ def __init__( self._remove_device_updated = async_track_device_registry_updated_event( hass, device_id, self._async_device_removed ) - _LOGGER.info( + _LOGGER.debug( "%s %s has been initialized", self.log_name, discovery_hash, @@ -837,7 +837,7 @@ async def async_discovery_update( ) -> None: """Handle discovery update.""" discovery_hash = get_discovery_hash(self._discovery_data) - _LOGGER.info( + _LOGGER.debug( "Got update for %s with hash: %s '%s'", self.log_name, discovery_hash, @@ -847,8 +847,8 @@ async def async_discovery_update( discovery_payload and discovery_payload != self._discovery_data[ATTR_DISCOVERY_PAYLOAD] ): - _LOGGER.info( - "%s %s updating", + _LOGGER.debug( + "Updating %s with hash %s", self.log_name, discovery_hash, ) @@ -864,7 +864,7 @@ async def async_discovery_update( ) await self._async_tear_down() send_discovery_done(self.hass, self._discovery_data) - _LOGGER.info( + _LOGGER.debug( "%s %s has been removed", self.log_name, discovery_hash, @@ -872,7 +872,7 @@ async def async_discovery_update( else: # Normal update without change send_discovery_done(self.hass, self._discovery_data) - _LOGGER.info( + _LOGGER.debug( "%s %s no changes", self.log_name, discovery_hash,