Skip to content

Commit

Permalink
Merge pull request #347 from alandtse/#346
Browse files Browse the repository at this point in the history
v2.1.1
  • Loading branch information
alandtse authored Sep 8, 2019
2 parents 3e86308 + 33f3247 commit f834d18
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 66 deletions.
23 changes: 11 additions & 12 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
"""
import logging
from typing import Optional, Text

import voluptuous as vol

from typing import Optional, Text
from alexapy import WebsocketEchoClient
from homeassistant import util
from homeassistant.const import (
CONF_EMAIL, CONF_NAME, CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_URL,
EVENT_HOMEASSISTANT_STOP)
from homeassistant.const import (CONF_EMAIL, CONF_NAME, CONF_PASSWORD,
CONF_SCAN_INTERVAL, CONF_URL,
EVENT_HOMEASSISTANT_STOP)
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.discovery import async_load_platform
from alexapy import WebsocketEchoClient
from homeassistant.helpers.event import async_call_later

from .const import (
ALEXA_COMPONENTS, CONF_DEBUG, CONF_ACCOUNTS, CONF_INCLUDE_DEVICES,
CONF_EXCLUDE_DEVICES, DATA_ALEXAMEDIA, DOMAIN, MIN_TIME_BETWEEN_SCANS,
MIN_TIME_BETWEEN_FORCED_SCANS, SCAN_INTERVAL, SERVICE_UPDATE_LAST_CALLED,
ATTR_EMAIL, STARTUP, __version__
)
from .const import (ALEXA_COMPONENTS, ATTR_EMAIL, CONF_ACCOUNTS, CONF_DEBUG,
CONF_EXCLUDE_DEVICES, CONF_INCLUDE_DEVICES,
DATA_ALEXAMEDIA, DOMAIN, MIN_TIME_BETWEEN_FORCED_SCANS,
MIN_TIME_BETWEEN_SCANS, SCAN_INTERVAL,
SERVICE_UPDATE_LAST_CALLED, STARTUP, __version__)

# from .config_flow import configured_instances

Expand Down
17 changes: 6 additions & 11 deletions custom_components/alexa_media/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@

from homeassistant import util
from homeassistant.components.alarm_control_panel import AlarmControlPanel
from homeassistant.const import (STATE_ALARM_ARMED_AWAY,
STATE_ALARM_DISARMED)
from homeassistant.const import STATE_ALARM_ARMED_AWAY, STATE_ALARM_DISARMED
from homeassistant.helpers.event import async_call_later

from . import DATA_ALEXAMEDIA
from . import (CONF_EMAIL, CONF_EXCLUDE_DEVICES, CONF_INCLUDE_DEVICES,
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 . import MIN_TIME_BETWEEN_FORCED_SCANS, MIN_TIME_BETWEEN_SCANS, hide_email
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
2 changes: 1 addition & 1 deletion custom_components/alexa_media/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
from datetime import timedelta

__version__ = '2.1.0'
__version__ = '2.1.1'
PROJECT_URL = "https://github.com/custom-components/alexa_media_player/"
ISSUE_URL = "{}issues".format(PROJECT_URL)

Expand Down
3 changes: 2 additions & 1 deletion custom_components/alexa_media/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"""

import logging
from typing import List, Text, Callable
from typing import Callable, List, Text

from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_component import EntityComponent

Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"documentation": "https://github.com/custom-components/alexa_media_player/wiki",
"dependencies": [],
"codeowners": ["@keatontaylor", "@alandtse"],
"requirements": ["alexapy==1.0.2"],
"requirements": ["alexapy==1.1.1"],
"homeassistant": "0.96.0"
}
40 changes: 15 additions & 25 deletions custom_components/alexa_media/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,31 @@
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
"""
import logging

from typing import List # noqa pylint: disable=unused-import

import voluptuous as vol

from homeassistant import util
from homeassistant.components.media_player import (MediaPlayerDevice)
from homeassistant.components.media_player import MediaPlayerDevice
from homeassistant.components.media_player.const import (
DOMAIN,
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
SUPPORT_PLAY,
SUPPORT_PLAY_MEDIA,
SUPPORT_PREVIOUS_TRACK,
SUPPORT_SELECT_SOURCE,
SUPPORT_SHUFFLE_SET,
SUPPORT_STOP,
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET)
DOMAIN, MEDIA_TYPE_MUSIC, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PLAY,
SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK, SUPPORT_SELECT_SOURCE,
SUPPORT_SHUFFLE_SET, SUPPORT_STOP, SUPPORT_TURN_OFF, SUPPORT_TURN_ON,
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET)
from homeassistant.const import (STATE_IDLE, STATE_PAUSED, STATE_PLAYING,
STATE_STANDBY)
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.discovery import async_load_platform
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.service import extract_entity_ids
from homeassistant.helpers.discovery import async_load_platform

from . import CONF_EMAIL, CONF_NAME, DATA_ALEXAMEDIA
from . import DOMAIN as ALEXA_DOMAIN
from . import (MIN_TIME_BETWEEN_FORCED_SCANS, MIN_TIME_BETWEEN_SCANS,
hide_email, hide_serial)
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 +44,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
16 changes: 7 additions & 9 deletions custom_components/alexa_media/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
"""
import logging

from homeassistant.components.notify import (
ATTR_DATA, ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT,
BaseNotificationService
)

from . import (
DOMAIN as ALEXA_DOMAIN,
DATA_ALEXAMEDIA,
hide_email, hide_serial)
from homeassistant.components.notify import (ATTR_DATA, ATTR_TARGET,
ATTR_TITLE, ATTR_TITLE_DEFAULT,
BaseNotificationService)

from . import DATA_ALEXAMEDIA
from . import DOMAIN as ALEXA_DOMAIN
from . import hide_email, hide_serial
from .helpers import retry_async

_LOGGER = logging.getLogger(__name__)
Expand Down
10 changes: 4 additions & 6 deletions custom_components/alexa_media/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
from homeassistant.exceptions import NoEntitySpecifiedError
from homeassistant.helpers.event import async_call_later

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

_LOGGER = logging.getLogger(__name__)
Expand Down

0 comments on commit f834d18

Please sign in to comment.