diff --git a/custom_components/mail_and_packages/helpers.py b/custom_components/mail_and_packages/helpers.py index ece3a762..94ba2d42 100644 --- a/custom_components/mail_and_packages/helpers.py +++ b/custom_components/mail_and_packages/helpers.py @@ -303,7 +303,9 @@ async def image_file_name( # Insert place holder image _LOGGER.debug("Copying %s to %s", mail_none, os.path.join(path, image_name)) - copyfile(mail_none, os.path.join(path, image_name)) + await hass.async_add_executor_job( + copyfile, mail_none, os.path.join(path, image_name) + ) return image_name @@ -365,17 +367,19 @@ async def fetch( nomail, ) elif sensor == AMAZON_PACKAGES: - count[sensor] = get_items( - account=account, - param=ATTR_COUNT, - fwds=amazon_fwds, - days=amazon_days, + count[sensor] = await hass.async_add_executor_job( + get_items, + account, + ATTR_COUNT, + amazon_fwds, + amazon_days, ) - count[AMAZON_ORDER] = get_items( - account=account, - param=ATTR_ORDER, - fwds=amazon_fwds, - days=amazon_days, + count[AMAZON_ORDER] = await hass.async_add_executor_job( + get_items, + account, + ATTR_ORDER, + amazon_fwds, + amazon_days, ) elif sensor == AMAZON_HUB: value = amazon_hub(account, amazon_fwds)