Skip to content

Commit

Permalink
fix: use async_forward_entry_setups for HA 2024.7.x+ (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Jun 27, 2024
1 parent 6d5c0fd commit e78fd30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 1 addition & 5 deletions custom_components/mail_and_packages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
COORDINATOR: coordinator,
}

for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)

await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
return True


Expand Down
5 changes: 4 additions & 1 deletion custom_components/mail_and_packages/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ def process_emails(hass: HomeAssistant, config: ConfigEntry) -> dict:

# Only update sensors we're intrested in
for sensor in resources:
fetch(hass, config, account, data, sensor)
try:
fetch(hass, config, account, data, sensor)
except Exception as err:
_LOGGER.error("Error updating sensor: %s reason: %s", sensor, err)

# Copy image file to www directory if enabled
if config.get(CONF_ALLOW_EXTERNAL):
Expand Down

0 comments on commit e78fd30

Please sign in to comment.