diff --git a/custom_components/ms365_teams/__init__.py b/custom_components/ms365_teams/__init__.py index 7f57f42..94b65bb 100644 --- a/custom_components/ms365_teams/__init__.py +++ b/custom_components/ms365_teams/__init__.py @@ -42,7 +42,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: MS365ConfigEntry): ) if is_authenticated and permissions and permissions != TOKEN_FILE_MISSING: - _LOGGER.debug("do setup") + _LOGGER.debug("Do setup") check_token = await _async_check_token(hass, account, entity_name) if check_token: coordinator, sensors, platforms = await async_do_setup(hass, entry, account) diff --git a/custom_components/ms365_teams/integration/coordinator_integration.py b/custom_components/ms365_teams/integration/coordinator_integration.py index 55cb65c..cf1dbb5 100644 --- a/custom_components/ms365_teams/integration/coordinator_integration.py +++ b/custom_components/ms365_teams/integration/coordinator_integration.py @@ -56,16 +56,16 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry, account): self._entry = entry self._account = account self._entity_name = entry.data[CONF_ENTITY_NAME] - self._keys = [] + self.keys = [] self._data = {} self._chat_members = {} - async def async_setup_entries(self): + async def _async_setup(self): """Do the initial setup of the entities.""" status_keys = await self._async_status_sensors() chat_keys = self._chat_sensors() - self._keys = chat_keys + status_keys - return self._keys + self.keys = chat_keys + status_keys + return self.keys async def _async_status_sensors(self): keys = [] @@ -110,10 +110,10 @@ def _chat_sensors(self): async def _async_update_data(self): _LOGGER.debug( - "Doing %s email update(s) for: %s", len(self._keys), self._entity_name + "Doing %s email update(s) for: %s", len(self.keys), self._entity_name ) - for key in self._keys: + for key in self.keys: entity_type = key[CONF_ENTITY_TYPE] if entity_type == SENSOR_TEAMS_CHAT: await self._async_teams_chat_update(key) diff --git a/custom_components/ms365_teams/integration/setup_integration.py b/custom_components/ms365_teams/integration/setup_integration.py index 2c6d379..958c259 100644 --- a/custom_components/ms365_teams/integration/setup_integration.py +++ b/custom_components/ms365_teams/integration/setup_integration.py @@ -16,8 +16,6 @@ async def async_do_setup(hass: HomeAssistant, entry: ConfigEntry, account): _LOGGER.debug("Sensor setup - start") sensor_coordinator = MS365SensorCoordinator(hass, entry, account) - sensor_keys = await sensor_coordinator.async_setup_entries() - if sensor_keys: - await sensor_coordinator.async_config_entry_first_refresh() - _LOGGER.debug("Email setup - finish") - return sensor_coordinator, sensor_keys, PLATFORMS + await sensor_coordinator.async_config_entry_first_refresh() + _LOGGER.debug("Sensor setup - finish") + return sensor_coordinator, sensor_coordinator.keys, PLATFORMS