Skip to content

Commit

Permalink
fix: remove redudant alexa_setup
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Apr 19, 2020
1 parent 497b132 commit e0a29ab
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ async def close_alexa_media(event=None) -> None:
)
await login.login_with_cookie()
if await test_login_status(hass, config_entry, login, setup_alexa):
await hass.async_add_job(setup_alexa, hass, config_entry, login)
return True
return False

Expand Down Expand Up @@ -292,8 +291,7 @@ async def async_update_data():
"%s: Alexa API disconnected; attempting to relogin", hide_email(email)
)
await login_obj.login_with_cookie()
if await test_login_status(hass, config_entry, login_obj, setup_alexa):
await hass.async_add_job(setup_alexa, hass, config_entry, login_obj)
await test_login_status(hass, config_entry, login_obj, setup_alexa)
return
except BaseException as err:
raise UpdateFailed(f"Error communicating with API: {err}")
Expand Down Expand Up @@ -394,22 +392,12 @@ async def async_update_data():
cleaned_config.pop(CONF_PASSWORD, None)
# CONF_PASSWORD contains sensitive info which is no longer needed
for component in ALEXA_COMPONENTS:
if component == "notify":
hass.async_create_task(
async_load_platform(
hass,
component,
DOMAIN,
{CONF_NAME: DOMAIN, "config": cleaned_config},
config,
)
)
else:
hass.async_add_job(
hass.config_entries.async_forward_entry_setup(
config_entry, component
)
_LOGGER.debug("Loading %s", component)
hass.async_add_job(
hass.config_entries.async_forward_entry_setup(
config_entry, component
)
)

hass.data[DATA_ALEXAMEDIA]["accounts"][email]["new_devices"] = False

Expand Down

0 comments on commit e0a29ab

Please sign in to comment.