Skip to content

Commit

Permalink
fix: fix HA warning re deprecated classes
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed May 23, 2020
1 parent d528c93 commit db8c055
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions custom_components/alexa_media/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
For more details about this platform, please refer to the documentation at
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
"""
import logging
from asyncio import sleep
import logging
from typing import Dict, List, Text # noqa pylint: disable=unused-import

from homeassistant import util
from homeassistant.components.alarm_control_panel import AlarmControlPanel
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_DISARMED,
Expand All @@ -36,6 +35,14 @@
)
from .helpers import _catch_login_errors, add_devices, retry_async

try:
from homeassistant.components.alarm_control_panel import (
AlarmControlPanelEntity as AlarmControlPanel,
)
except ImportError:
from homeassistant.components.alarm_control_panel import AlarmControlPanel


_LOGGER = logging.getLogger(__name__)

DEPENDENCIES = [ALEXA_DOMAIN]
Expand Down
8 changes: 7 additions & 1 deletion custom_components/alexa_media/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from typing import List, Text # noqa pylint: disable=unused-import

from homeassistant import util
from homeassistant.components.media_player import MediaPlayerDevice
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
Expand Down Expand Up @@ -56,6 +55,13 @@
from .const import DEPENDENT_ALEXA_COMPONENTS, PLAY_SCAN_INTERVAL
from .helpers import _catch_login_errors, add_devices, retry_async

try:
from homeassistant.components.media_player import (
MediaPlayerEntity as MediaPlayerDevice,
)
except ImportError:
from homeassistant.components.media_player import MediaPlayerDevice

SUPPORT_ALEXA = (
SUPPORT_PAUSE
| SUPPORT_PREVIOUS_TRACK
Expand Down
6 changes: 5 additions & 1 deletion custom_components/alexa_media/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import logging
from typing import List # noqa pylint: disable=unused-import

from homeassistant.components.switch import SwitchDevice
from homeassistant.exceptions import ConfigEntryNotReady, NoEntitySpecifiedError
from homeassistant.helpers.dispatcher import async_dispatcher_connect

Expand All @@ -25,6 +24,11 @@
)
from .helpers import _catch_login_errors, add_devices, retry_async

try:
from homeassistant.components.switch import SwitchEntity as SwitchDevice
except ImportError:
from homeassistant.components.switch import SwitchDevice

_LOGGER = logging.getLogger(__name__)


Expand Down

0 comments on commit db8c055

Please sign in to comment.