diff --git a/custom_components/econet300/entity.py b/custom_components/econet300/entity.py index b28995d..edc8459 100644 --- a/custom_components/econet300/entity.py +++ b/custom_components/econet300/entity.py @@ -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]