Skip to content

Commit

Permalink
fix: add enable retry for media_player and alarm_control_panel setup
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Sep 8, 2019
1 parent 3e86308 commit 2f2f7a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
10 changes: 2 additions & 8 deletions custom_components/alexa_media/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@

from . import DATA_ALEXAMEDIA
from . import DOMAIN as ALEXA_DOMAIN
from . import (
CONF_EMAIL,
MIN_TIME_BETWEEN_FORCED_SCANS,
MIN_TIME_BETWEEN_SCANS, hide_email,
CONF_EXCLUDE_DEVICES, CONF_INCLUDE_DEVICES
)
from .helpers import add_devices
from .helpers import add_devices, retry_async

_LOGGER = logging.getLogger(__name__)

DEPENDENCIES = [ALEXA_DOMAIN]


@retry_async(limit=5, delay=2, catch_exceptions=True)
async def async_setup_platform(hass,
config,
add_devices_callback,
Expand Down
11 changes: 3 additions & 8 deletions custom_components/alexa_media/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,8 @@
from homeassistant.helpers.discovery import async_load_platform

from .const import ATTR_MESSAGE, PLAY_SCAN_INTERVAL
from .helpers import add_devices

from . import (
DOMAIN as ALEXA_DOMAIN,
CONF_NAME, CONF_EMAIL,
DATA_ALEXAMEDIA,
MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS,
hide_email, hide_serial)
from .helpers import add_devices, retry_async

SUPPORT_ALEXA = (SUPPORT_PAUSE | SUPPORT_PREVIOUS_TRACK |
SUPPORT_NEXT_TRACK | SUPPORT_STOP |
SUPPORT_VOLUME_SET | SUPPORT_PLAY |
Expand All @@ -55,6 +49,7 @@
DEPENDENCIES = [ALEXA_DOMAIN]


@retry_async(limit=5, delay=2, catch_exceptions=True)
async def async_setup_platform(hass, config, add_devices_callback,
discovery_info=None):
"""Set up the Alexa media player platform."""
Expand Down

0 comments on commit 2f2f7a0

Please sign in to comment.