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:
@@ -83,7 +83,7 @@ def _async_device_entities(
|
|||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Adding %s entity %s for %s",
|
"Adding %s entity %s for %s",
|
||||||
klass.__name__,
|
klass.__name__,
|
||||||
description.name,
|
description.key,
|
||||||
device.display_name,
|
device.display_name,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
@@ -111,7 +111,7 @@ def _async_device_entities(
|
|||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Adding %s entity %s for %s",
|
"Adding %s entity %s for %s",
|
||||||
klass.__name__,
|
klass.__name__,
|
||||||
description.name,
|
description.key,
|
||||||
device.display_name,
|
device.display_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -252,16 +252,11 @@ class BaseProtectEntity(Entity):
|
|||||||
|
|
||||||
if changed:
|
if changed:
|
||||||
if _LOGGER.isEnabledFor(logging.DEBUG):
|
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(
|
_LOGGER.debug(
|
||||||
"Updating state [%s (%s)] %s -> %s",
|
"Updating state [%s] %s -> %s",
|
||||||
device_name,
|
self.entity_id,
|
||||||
device.mac,
|
|
||||||
previous_attrs,
|
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()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
|||||||
@@ -377,9 +377,7 @@ class ProtectSelects(ProtectDeviceEntity, SelectEntity):
|
|||||||
entity_description.entity_category is not None
|
entity_description.entity_category is not None
|
||||||
and entity_description.ufp_options_fn is not None
|
and entity_description.ufp_options_fn is not None
|
||||||
):
|
):
|
||||||
_LOGGER.debug(
|
_LOGGER.debug("Updating dynamic select options for %s", self.entity_id)
|
||||||
"Updating dynamic select options for %s", entity_description.name
|
|
||||||
)
|
|
||||||
self._async_set_options(self.data, entity_description)
|
self._async_set_options(self.data, entity_description)
|
||||||
if (unifi_value := entity_description.get_ufp_value(device)) is None:
|
if (unifi_value := entity_description.get_ufp_value(device)) is None:
|
||||||
unifi_value = TYPE_EMPTY_VALUE
|
unifi_value = TYPE_EMPTY_VALUE
|
||||||
|
|||||||
Reference in New Issue
Block a user