From 2af1e098ccbfe6abb2871b119fba64a0907ee5e7 Mon Sep 17 00:00:00 2001 From: Raphael Hehl <7577984+RaHehl@users.noreply.github.com> Date: Wed, 17 Dec 2025 20:31:33 +0100 Subject: [PATCH] Improve debug logging in UniFi Protect integration (#159318) --- homeassistant/components/unifiprotect/entity.py | 15 +++++---------- homeassistant/components/unifiprotect/select.py | 4 +--- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/unifiprotect/entity.py b/homeassistant/components/unifiprotect/entity.py index 8210145f3f8..35d750c2d8d 100644 --- a/homeassistant/components/unifiprotect/entity.py +++ b/homeassistant/components/unifiprotect/entity.py @@ -83,7 +83,7 @@ def _async_device_entities( _LOGGER.debug( "Adding %s entity %s for %s", klass.__name__, - description.name, + description.key, device.display_name, ) continue @@ -111,7 +111,7 @@ def _async_device_entities( _LOGGER.debug( "Adding %s entity %s for %s", klass.__name__, - description.name, + description.key, device.display_name, ) @@ -252,16 +252,11 @@ class BaseProtectEntity(Entity): if changed: if _LOGGER.isEnabledFor(logging.DEBUG): - device_name = device.name or "" - if hasattr(self, "entity_description") and self.entity_description.name: - device_name += f" {self.entity_description.name}" - _LOGGER.debug( - "Updating state [%s (%s)] %s -> %s", - device_name, - device.mac, + "Updating state [%s] %s -> %s", + self.entity_id, previous_attrs, - tuple((getattr(self, attr)) for attr in self._state_attrs), + tuple(getter() for getter in self._state_getters), ) self.async_write_ha_state() diff --git a/homeassistant/components/unifiprotect/select.py b/homeassistant/components/unifiprotect/select.py index dad914ff7e8..6fa3d9a40f2 100644 --- a/homeassistant/components/unifiprotect/select.py +++ b/homeassistant/components/unifiprotect/select.py @@ -377,9 +377,7 @@ class ProtectSelects(ProtectDeviceEntity, SelectEntity): entity_description.entity_category is not None and entity_description.ufp_options_fn is not None ): - _LOGGER.debug( - "Updating dynamic select options for %s", entity_description.name - ) + _LOGGER.debug("Updating dynamic select options for %s", self.entity_id) self._async_set_options(self.data, entity_description) if (unifi_value := entity_description.get_ufp_value(device)) is None: unifi_value = TYPE_EMPTY_VALUE