Skip to content

Commit

Permalink
Fix async icon loading
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed May 1, 2020
1 parent 0b6afed commit e0280d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/favicon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def async_setup(hass, config):
if CONFIG_TITLE in hass.data[DOMAIN]:
del hass.data[DOMAIN][CONFIG_TITLE]
hass.data[DOMAIN].update(conf)
return apply_hooks(hass)
return await apply_hooks(hass)

async def async_setup_entry(hass, config_entry):
config_entry.add_update_listener(_update_listener)
Expand All @@ -51,7 +51,7 @@ async def _update_listener(hass, config_entry):
if CONFIG_TITLE in hass.data[DOMAIN]:
del hass.data[DOMAIN][CONFIG_TITLE]
hass.data[DOMAIN].update(conf)
return apply_hooks(hass)
return await apply_hooks(hass)


def find_icons(hass, path):
Expand Down Expand Up @@ -88,9 +88,9 @@ def find_icons(hass, path):
icons["manifest"] = manifest
return icons

def apply_hooks(hass):
async def apply_hooks(hass):
data = hass.data.get(DOMAIN, {})
icons = find_icons(hass, data.get(CONFIG_ICON_PATH, None))
icons = await hass.loop.run_in_executor(None, find_icons, hass, data.get(CONFIG_ICON_PATH, None))
title = data.get(CONFIG_TITLE, None)

def _get_template(self):
Expand Down

0 comments on commit e0280d0

Please sign in to comment.