1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-20 02:48:57 +00:00

Improve debug logging in UniFi Protect integration (#159318)

This commit is contained in:
Raphael Hehl
2025-12-17 20:31:33 +01:00
committed by GitHub
parent c418d9750b
commit 2af1e098cc
2 changed files with 6 additions and 13 deletions

View File

@@ -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()

View File

@@ -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