Skip to content

Commit

Permalink
add entity logger.debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jontofront committed Dec 25, 2023
1 parent a735ac1 commit 78df040
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/econet300/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,23 @@ def _handle_coordinator_update(self) -> None:

async def async_added_to_hass(self):
"""Handle added to hass."""
_LOGGER.debug("Entering async_added_to_hass method")
_LOGGER.debug("Added to HASS: %s", self.entity_description)
_LOGGER.debug("Coordinator: %s", self.coordinator)

_LOGGER.debug("Added to HASS: %s", self.entity_description.name)

if "data" not in dir(self.coordinator):
_LOGGER.error("Coordinator object does not have a 'data' attribute")
return

if self.coordinator.data[self.entity_description.key] is None:
_LOGGER.warning(
"Data key: %s was expected to exist but it doesn't",
self.entity_description.key,
)

_LOGGER.debug("Exiting async_added_to_hass method")
return

value = self.coordinator.data[self.entity_description.key]
Expand Down

0 comments on commit 78df040

Please sign in to comment.