Rename MediaPlayerDevice to MediaPlayerEntity (#34592)
parent
56f7c3b55c
commit
62bc02fdda
|
@ -16,7 +16,7 @@ from androidtv.constants import APPS, KEYS
|
||||||
from androidtv.exceptions import LockNotAcquiredException
|
from androidtv.exceptions import LockNotAcquiredException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -373,7 +373,7 @@ def adb_decorator(override_available=False):
|
||||||
return _adb_decorator
|
return _adb_decorator
|
||||||
|
|
||||||
|
|
||||||
class ADBDevice(MediaPlayerDevice):
|
class ADBDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Android TV or Fire TV device."""
|
"""Representation of an Android TV or Fire TV device."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import anthemav
|
import anthemav
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -79,7 +79,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities([device])
|
async_add_entities([device])
|
||||||
|
|
||||||
|
|
||||||
class AnthemAVR(MediaPlayerDevice):
|
class AnthemAVR(MediaPlayerEntity):
|
||||||
"""Entity reading values from Anthem AVR protocol."""
|
"""Entity reading values from Anthem AVR protocol."""
|
||||||
|
|
||||||
def __init__(self, avr, name):
|
def __init__(self, avr, name):
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
|
|
||||||
import pyatv.const as atv_const
|
import pyatv.const as atv_const
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
MEDIA_TYPE_TVSHOW,
|
MEDIA_TYPE_TVSHOW,
|
||||||
|
@ -76,7 +76,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
|
|
||||||
class AppleTvDevice(MediaPlayerDevice):
|
class AppleTvDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Apple TV device."""
|
"""Representation of an Apple TV device."""
|
||||||
|
|
||||||
def __init__(self, atv, name, power):
|
def __init__(self, atv, name, power):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import sharp_aquos_rc
|
import sharp_aquos_rc
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -121,7 +121,7 @@ def _retry(func):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
class SharpAquosTVDevice(MediaPlayerDevice):
|
class SharpAquosTVDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Aquos TV."""
|
"""Representation of a Aquos TV."""
|
||||||
|
|
||||||
def __init__(self, name, remote, power_on_enabled=False):
|
def __init__(self, name, remote, power_on_enabled=False):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from arcam.fmj import DecodeMode2CH, DecodeModeMCH, IncomingAudioFormat, SourceC
|
||||||
from arcam.fmj.state import State
|
from arcam.fmj.state import State
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_SELECT_SOUND_MODE,
|
SUPPORT_SELECT_SOUND_MODE,
|
||||||
|
@ -63,7 +63,7 @@ async def async_setup_entry(
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ArcamFmj(MediaPlayerDevice):
|
class ArcamFmj(MediaPlayerEntity):
|
||||||
"""Representation of a media device."""
|
"""Representation of a media device."""
|
||||||
|
|
||||||
def __init__(self, state: State, name: str, turn_on: Optional[ConfigType]):
|
def __init__(self, state: State, name: str, turn_on: Optional[ConfigType]):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from pyblackbird import get_blackbird
|
||||||
from serial import SerialException
|
from serial import SerialException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -128,7 +128,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BlackbirdZone(MediaPlayerDevice):
|
class BlackbirdZone(MediaPlayerEntity):
|
||||||
"""Representation of a Blackbird matrix zone."""
|
"""Representation of a Blackbird matrix zone."""
|
||||||
|
|
||||||
def __init__(self, blackbird, sources, zone_id, zone_name):
|
def __init__(self, blackbird, sources, zone_id, zone_name):
|
||||||
|
|
|
@ -12,7 +12,7 @@ import async_timeout
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
import xmltodict
|
import xmltodict
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
ATTR_MEDIA_ENQUEUE,
|
ATTR_MEDIA_ENQUEUE,
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
|
@ -200,7 +200,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BluesoundPlayer(MediaPlayerDevice):
|
class BluesoundPlayer(MediaPlayerEntity):
|
||||||
"""Representation of a Bluesound Player."""
|
"""Representation of a Bluesound Player."""
|
||||||
|
|
||||||
def __init__(self, hass, host, port=None, name=None, init_callback=None):
|
def __init__(self, hass, host, port=None, name=None, init_callback=None):
|
||||||
|
|
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
DEVICE_CLASS_TV,
|
DEVICE_CLASS_TV,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
MediaPlayerDevice,
|
MediaPlayerEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -116,7 +116,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BraviaTVDevice(MediaPlayerDevice):
|
class BraviaTVDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Bravia TV."""
|
"""Representation of a Bravia TV."""
|
||||||
|
|
||||||
def __init__(self, client, name, pin, unique_id, device_info, ignored_sources):
|
def __init__(self, client, name, pin, unique_id, device_info, ignored_sources):
|
||||||
|
|
|
@ -12,7 +12,7 @@ from pychromecast.socket_client import (
|
||||||
)
|
)
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MOVIE,
|
MEDIA_TYPE_MOVIE,
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
|
@ -171,7 +171,7 @@ async def _async_setup_platform(
|
||||||
hass.async_add_executor_job(setup_internal_discovery, hass)
|
hass.async_add_executor_job(setup_internal_discovery, hass)
|
||||||
|
|
||||||
|
|
||||||
class CastDevice(MediaPlayerDevice):
|
class CastDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Cast device on the network.
|
"""Representation of a Cast device on the network.
|
||||||
|
|
||||||
This class is the holder of the pychromecast.Chromecast object and its
|
This class is the holder of the pychromecast.Chromecast object and its
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from pychannels import Channels
|
from pychannels import Channels
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
MEDIA_TYPE_EPISODE,
|
MEDIA_TYPE_EPISODE,
|
||||||
|
@ -116,7 +116,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ChannelsPlayer(MediaPlayerDevice):
|
class ChannelsPlayer(MediaPlayerEntity):
|
||||||
"""Representation of a Channels instance."""
|
"""Representation of a Channels instance."""
|
||||||
|
|
||||||
def __init__(self, name, host, port):
|
def __init__(self, name, host, port):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import time
|
||||||
from clementineremote import ClementineRemote
|
from clementineremote import ClementineRemote
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -67,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([ClementineDevice(client, config[CONF_NAME])])
|
add_entities([ClementineDevice(client, config[CONF_NAME])])
|
||||||
|
|
||||||
|
|
||||||
class ClementineDevice(MediaPlayerDevice):
|
class ClementineDevice(MediaPlayerEntity):
|
||||||
"""Representation of Clementine Player."""
|
"""Representation of Clementine Player."""
|
||||||
|
|
||||||
def __init__(self, client, name):
|
def __init__(self, client, name):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from pycmus import exceptions, remote
|
from pycmus import exceptions, remote
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
MEDIA_TYPE_PLAYLIST,
|
MEDIA_TYPE_PLAYLIST,
|
||||||
|
@ -72,7 +72,7 @@ def setup_platform(hass, config, add_entities, discover_info=None):
|
||||||
add_entities([cmus_remote], True)
|
add_entities([cmus_remote], True)
|
||||||
|
|
||||||
|
|
||||||
class CmusDevice(MediaPlayerDevice):
|
class CmusDevice(MediaPlayerEntity):
|
||||||
"""Representation of a running cmus."""
|
"""Representation of a running cmus."""
|
||||||
|
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Demo implementation of the media player."""
|
"""Demo implementation of the media player."""
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MOVIE,
|
MEDIA_TYPE_MOVIE,
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
|
@ -93,7 +93,7 @@ NETFLIX_PLAYER_SUPPORT = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AbstractDemoPlayer(MediaPlayerDevice):
|
class AbstractDemoPlayer(MediaPlayerEntity):
|
||||||
"""A demo media players."""
|
"""A demo media players."""
|
||||||
|
|
||||||
# We only implement the methods that we support
|
# We only implement the methods that we support
|
||||||
|
|
|
@ -4,7 +4,7 @@ import telnetlib
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -86,7 +86,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([denon])
|
add_entities([denon])
|
||||||
|
|
||||||
|
|
||||||
class DenonDevice(MediaPlayerDevice):
|
class DenonDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Denon device."""
|
"""Representation of a Denon device."""
|
||||||
|
|
||||||
def __init__(self, name, host):
|
def __init__(self, name, host):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
||||||
import denonavr
|
import denonavr
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
|
@ -159,7 +159,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(receivers)
|
add_entities(receivers)
|
||||||
|
|
||||||
|
|
||||||
class DenonDevice(MediaPlayerDevice):
|
class DenonDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Denon Media Player Device."""
|
"""Representation of a Denon Media Player Device."""
|
||||||
|
|
||||||
def __init__(self, receiver):
|
def __init__(self, receiver):
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Callable, List
|
||||||
|
|
||||||
from directv import DIRECTV
|
from directv import DIRECTV
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
MEDIA_TYPE_MOVIE,
|
MEDIA_TYPE_MOVIE,
|
||||||
|
@ -77,7 +77,7 @@ async def async_setup_entry(
|
||||||
async_add_entities(entities, True)
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerDevice):
|
class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerEntity):
|
||||||
"""Representation of a DirecTV receiver on the network."""
|
"""Representation of a DirecTV receiver on the network."""
|
||||||
|
|
||||||
def __init__(self, *, dtv: DIRECTV, name: str, address: str = "0") -> None:
|
def __init__(self, *, dtv: DIRECTV, name: str, address: str = "0") -> None:
|
||||||
|
@ -141,7 +141,7 @@ class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerDevice):
|
||||||
|
|
||||||
return self._address
|
return self._address
|
||||||
|
|
||||||
# MediaPlayerDevice properties and methods
|
# MediaPlayerEntity properties and methods
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
|
|
|
@ -11,7 +11,7 @@ from async_upnp_client.aiohttp import AiohttpNotifyServer, AiohttpSessionRequest
|
||||||
from async_upnp_client.profiles.dlna import DeviceState, DmrDevice
|
from async_upnp_client.profiles.dlna import DeviceState, DmrDevice
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
MEDIA_TYPE_EPISODE,
|
MEDIA_TYPE_EPISODE,
|
||||||
|
@ -194,7 +194,7 @@ async def async_setup_platform(
|
||||||
async_add_entities([device], True)
|
async_add_entities([device], True)
|
||||||
|
|
||||||
|
|
||||||
class DlnaDmrDevice(MediaPlayerDevice):
|
class DlnaDmrDevice(MediaPlayerEntity):
|
||||||
"""Representation of a DLNA DMR device."""
|
"""Representation of a DLNA DMR device."""
|
||||||
|
|
||||||
def __init__(self, dmr_device, name=None):
|
def __init__(self, dmr_device, name=None):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from pdunehd import DuneHDPlayer
|
from pdunehd import DuneHDPlayer
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -55,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([DuneHDPlayerEntity(DuneHDPlayer(host), name, sources)], True)
|
add_entities([DuneHDPlayerEntity(DuneHDPlayer(host), name, sources)], True)
|
||||||
|
|
||||||
|
|
||||||
class DuneHDPlayerEntity(MediaPlayerDevice):
|
class DuneHDPlayerEntity(MediaPlayerEntity):
|
||||||
"""Implementation of the Dune HD player."""
|
"""Implementation of the Dune HD player."""
|
||||||
|
|
||||||
def __init__(self, player, name, sources):
|
def __init__(self, player, name, sources):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from pyemby import EmbyServer
|
from pyemby import EmbyServer
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
MEDIA_TYPE_MOVIE,
|
MEDIA_TYPE_MOVIE,
|
||||||
|
@ -134,7 +134,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, stop_emby)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, stop_emby)
|
||||||
|
|
||||||
|
|
||||||
class EmbyDevice(MediaPlayerDevice):
|
class EmbyDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Emby device."""
|
"""Representation of an Emby device."""
|
||||||
|
|
||||||
def __init__(self, emby, device_id):
|
def __init__(self, emby, device_id):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from openwebif.api import CreateDevice
|
from openwebif.api import CreateDevice
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_TVSHOW,
|
MEDIA_TYPE_TVSHOW,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -117,7 +117,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices([Enigma2Device(config[CONF_NAME], device)], True)
|
add_devices([Enigma2Device(config[CONF_NAME], device)], True)
|
||||||
|
|
||||||
|
|
||||||
class Enigma2Device(MediaPlayerDevice):
|
class Enigma2Device(MediaPlayerEntity):
|
||||||
"""Representation of an Enigma2 box."""
|
"""Representation of an Enigma2 box."""
|
||||||
|
|
||||||
def __init__(self, name, device):
|
def __init__(self, name, device):
|
||||||
|
|
|
@ -26,7 +26,7 @@ from epson_projector.const import (
|
||||||
)
|
)
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PREVIOUS_TRACK,
|
SUPPORT_PREVIOUS_TRACK,
|
||||||
|
@ -124,7 +124,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class EpsonProjector(MediaPlayerDevice):
|
class EpsonProjector(MediaPlayerEntity):
|
||||||
"""Representation of Epson Projector Device."""
|
"""Representation of Epson Projector Device."""
|
||||||
|
|
||||||
def __init__(self, websession, name, host, port, encryption):
|
def __init__(self, websession, name, host, port, encryption):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from afsapi import AFSAPI
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -94,7 +94,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class AFSAPIDevice(MediaPlayerDevice):
|
class AFSAPIDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Frontier Silicon device on the network."""
|
"""Representation of a Frontier Silicon device on the network."""
|
||||||
|
|
||||||
def __init__(self, device_url, password, name):
|
def __init__(self, device_url, password, name):
|
||||||
|
|
|
@ -7,7 +7,7 @@ import time
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from websocket import _exceptions, create_connection
|
from websocket import _exceptions, create_connection
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -167,7 +167,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
setup_gpmdp(hass, config, code, add_entities)
|
setup_gpmdp(hass, config, code, add_entities)
|
||||||
|
|
||||||
|
|
||||||
class GPMDP(MediaPlayerDevice):
|
class GPMDP(MediaPlayerEntity):
|
||||||
"""Representation of a GPMDP."""
|
"""Representation of a GPMDP."""
|
||||||
|
|
||||||
def __init__(self, name, url, code):
|
def __init__(self, name, url, code):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from gsp import GstreamerPlayer
|
from gsp import GstreamerPlayer
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([GstreamerDevice(player, name)])
|
add_entities([GstreamerDevice(player, name)])
|
||||||
|
|
||||||
|
|
||||||
class GstreamerDevice(MediaPlayerDevice):
|
class GstreamerDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Gstreamer device."""
|
"""Representation of a Gstreamer device."""
|
||||||
|
|
||||||
def __init__(self, player, name):
|
def __init__(self, player, name):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import hkavr
|
import hkavr
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_entities, discover_info=None):
|
||||||
add_entities([avr_device], True)
|
add_entities([avr_device], True)
|
||||||
|
|
||||||
|
|
||||||
class HkAvrDevice(MediaPlayerDevice):
|
class HkAvrDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Harman Kardon AVR / JBL AVR TV."""
|
"""Representation of a Harman Kardon AVR / JBL AVR TV."""
|
||||||
|
|
||||||
def __init__(self, avr):
|
def __init__(self, avr):
|
||||||
|
|
|
@ -22,7 +22,7 @@ from pycec.const import (
|
||||||
TYPE_TUNER,
|
TYPE_TUNER,
|
||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(entities, True)
|
add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
class CecPlayerDevice(CecDevice, MediaPlayerDevice):
|
class CecPlayerDevice(CecDevice, MediaPlayerEntity):
|
||||||
"""Representation of a HDMI device as a Media player."""
|
"""Representation of a HDMI device as a Media player."""
|
||||||
|
|
||||||
def __init__(self, device, logical) -> None:
|
def __init__(self, device, logical) -> None:
|
||||||
|
|
|
@ -6,7 +6,7 @@ from typing import Sequence
|
||||||
|
|
||||||
from pyheos import HeosError, const as heos_const
|
from pyheos import HeosError, const as heos_const
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
ATTR_MEDIA_ENQUEUE,
|
ATTR_MEDIA_ENQUEUE,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
@ -85,7 +85,7 @@ def log_command_error(command: str):
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
class HeosMediaPlayer(MediaPlayerDevice):
|
class HeosMediaPlayer(MediaPlayerEntity):
|
||||||
"""The HEOS player."""
|
"""The HEOS player."""
|
||||||
|
|
||||||
def __init__(self, player):
|
def __init__(self, player):
|
||||||
|
|
|
@ -10,7 +10,7 @@ from aiohomekit.model.characteristics import (
|
||||||
from aiohomekit.model.services import ServicesTypes
|
from aiohomekit.model.services import ServicesTypes
|
||||||
from aiohomekit.utils import clamp_enum_to_char
|
from aiohomekit.utils import clamp_enum_to_char
|
||||||
|
|
||||||
from homeassistant.components.media_player import DEVICE_CLASS_TV, MediaPlayerDevice
|
from homeassistant.components.media_player import DEVICE_CLASS_TV, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
SUPPORT_PLAY,
|
SUPPORT_PLAY,
|
||||||
|
@ -54,7 +54,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
conn.add_listener(async_add_service)
|
conn.add_listener(async_add_service)
|
||||||
|
|
||||||
|
|
||||||
class HomeKitTelevision(HomeKitEntity, MediaPlayerDevice):
|
class HomeKitTelevision(HomeKitEntity, MediaPlayerEntity):
|
||||||
"""Representation of a HomeKit Controller Television."""
|
"""Representation of a HomeKit Controller Television."""
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
|
|
|
@ -7,7 +7,7 @@ from horimote.exceptions import AuthenticationError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -78,7 +78,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([HorizonDevice(client, name, keys)], True)
|
add_entities([HorizonDevice(client, name, keys)], True)
|
||||||
|
|
||||||
|
|
||||||
class HorizonDevice(MediaPlayerDevice):
|
class HorizonDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Horizon HD Recorder."""
|
"""Representation of a Horizon HD Recorder."""
|
||||||
|
|
||||||
def __init__(self, client, name, remote_keys):
|
def __init__(self, client, name, remote_keys):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
MEDIA_TYPE_PLAYLIST,
|
MEDIA_TYPE_PLAYLIST,
|
||||||
|
@ -205,7 +205,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ItunesDevice(MediaPlayerDevice):
|
class ItunesDevice(MediaPlayerEntity):
|
||||||
"""Representation of an iTunes API instance."""
|
"""Representation of an iTunes API instance."""
|
||||||
|
|
||||||
def __init__(self, name, host, port, use_ssl, add_entities):
|
def __init__(self, name, host, port, use_ssl, add_entities):
|
||||||
|
@ -408,7 +408,7 @@ class ItunesDevice(MediaPlayerDevice):
|
||||||
self.update_state(response)
|
self.update_state(response)
|
||||||
|
|
||||||
|
|
||||||
class AirPlayDevice(MediaPlayerDevice):
|
class AirPlayDevice(MediaPlayerEntity):
|
||||||
"""Representation an AirPlay device via an iTunes API instance."""
|
"""Representation an AirPlay device via an iTunes API instance."""
|
||||||
|
|
||||||
def __init__(self, device_id, client):
|
def __init__(self, device_id, client):
|
||||||
|
|
|
@ -23,7 +23,7 @@ from homeassistant.components.media_player import (
|
||||||
SUPPORT_VOLUME_MUTE,
|
SUPPORT_VOLUME_MUTE,
|
||||||
SUPPORT_VOLUME_SET,
|
SUPPORT_VOLUME_SET,
|
||||||
SUPPORT_VOLUME_STEP,
|
SUPPORT_VOLUME_STEP,
|
||||||
MediaPlayerDevice,
|
MediaPlayerEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
|
@ -174,7 +174,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
add_service(SERVICE_SUB_DB, "sub_db", "db_value")
|
add_service(SERVICE_SUB_DB, "sub_db", "db_value")
|
||||||
|
|
||||||
|
|
||||||
class KefMediaPlayer(MediaPlayerDevice):
|
class KefMediaPlayer(MediaPlayerEntity):
|
||||||
"""Kef Player Object."""
|
"""Kef Player Object."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -49,7 +49,7 @@ async def async_setup(hass, config):
|
||||||
if any((CONF_PLATFORM, DOMAIN) in cfg.items() for cfg in config.get(MP_DOMAIN, [])):
|
if any((CONF_PLATFORM, DOMAIN) in cfg.items() for cfg in config.get(MP_DOMAIN, [])):
|
||||||
# Register the Kodi media_player services
|
# Register the Kodi media_player services
|
||||||
async def async_service_handler(service):
|
async def async_service_handler(service):
|
||||||
"""Map services to methods on MediaPlayerDevice."""
|
"""Map services to methods on MediaPlayerEntity."""
|
||||||
method = SERVICE_TO_METHOD.get(service.service)
|
method = SERVICE_TO_METHOD.get(service.service)
|
||||||
if not method:
|
if not method:
|
||||||
return
|
return
|
||||||
|
|
|
@ -14,7 +14,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.kodi import SERVICE_CALL_METHOD
|
from homeassistant.components.kodi import SERVICE_CALL_METHOD
|
||||||
from homeassistant.components.kodi.const import DOMAIN
|
from homeassistant.components.kodi.const import DOMAIN
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
MEDIA_TYPE_MOVIE,
|
MEDIA_TYPE_MOVIE,
|
||||||
|
@ -248,7 +248,7 @@ def cmd(func):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
class KodiDevice(MediaPlayerDevice):
|
class KodiDevice(MediaPlayerEntity):
|
||||||
"""Representation of a XBMC/Kodi device."""
|
"""Representation of a XBMC/Kodi device."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -7,7 +7,7 @@ from requests import RequestException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -75,7 +75,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([LgTVDevice(client, name, on_action_script)], True)
|
add_entities([LgTVDevice(client, name, on_action_script)], True)
|
||||||
|
|
||||||
|
|
||||||
class LgTVDevice(MediaPlayerDevice):
|
class LgTVDevice(MediaPlayerEntity):
|
||||||
"""Representation of a LG TV."""
|
"""Representation of a LG TV."""
|
||||||
|
|
||||||
def __init__(self, client, name, on_action_script):
|
def __init__(self, client, name, on_action_script):
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
|
|
||||||
import temescal
|
import temescal
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOUND_MODE,
|
SUPPORT_SELECT_SOUND_MODE,
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
|
@ -28,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([LGDevice(discovery_info)], True)
|
add_entities([LGDevice(discovery_info)], True)
|
||||||
|
|
||||||
|
|
||||||
class LGDevice(MediaPlayerDevice):
|
class LGDevice(MediaPlayerEntity):
|
||||||
"""Representation of an LG soundbar device."""
|
"""Representation of an LG soundbar device."""
|
||||||
|
|
||||||
def __init__(self, discovery_info):
|
def __init__(self, discovery_info):
|
||||||
|
|
|
@ -337,8 +337,8 @@ async def async_unload_entry(hass, entry):
|
||||||
return await hass.data[DOMAIN].async_unload_entry(entry)
|
return await hass.data[DOMAIN].async_unload_entry(entry)
|
||||||
|
|
||||||
|
|
||||||
class MediaPlayerDevice(Entity):
|
class MediaPlayerEntity(Entity):
|
||||||
"""ABC for media player devices."""
|
"""ABC for media player entities."""
|
||||||
|
|
||||||
_access_token: Optional[str] = None
|
_access_token: Optional[str] = None
|
||||||
|
|
||||||
|
@ -924,3 +924,15 @@ async def websocket_handle_thumbnail(hass, connection, msg):
|
||||||
"content": base64.b64encode(data).decode("utf-8"),
|
"content": base64.b64encode(data).decode("utf-8"),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MediaPlayerDevice(MediaPlayerEntity):
|
||||||
|
"""ABC for media player devices (for backwards compatibility)."""
|
||||||
|
|
||||||
|
def __init_subclass__(cls, **kwargs):
|
||||||
|
"""Print deprecation warning."""
|
||||||
|
super().__init_subclass__(**kwargs)
|
||||||
|
_LOGGER.warning(
|
||||||
|
"MediaPlayerDevice is deprecated, modify %s to extend MediaPlayerEntity",
|
||||||
|
cls.__name__,
|
||||||
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from pymediaroom import PyMediaroomError, Remote, State, install_mediaroom_protocol
|
from pymediaroom import PyMediaroomError, Remote, State, install_mediaroom_protocol
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -118,7 +118,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
_LOGGER.debug("Auto discovery installed")
|
_LOGGER.debug("Auto discovery installed")
|
||||||
|
|
||||||
|
|
||||||
class MediaroomDevice(MediaPlayerDevice):
|
class MediaroomDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Mediaroom set-up-box on the network."""
|
"""Representation of a Mediaroom set-up-box on the network."""
|
||||||
|
|
||||||
def set_state(self, mediaroom_state):
|
def set_state(self, mediaroom_state):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from serial import SerialException
|
from serial import SerialException
|
||||||
|
|
||||||
from homeassistant import core
|
from homeassistant import core
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -107,7 +107,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class MonopriceZone(MediaPlayerDevice):
|
class MonopriceZone(MediaPlayerEntity):
|
||||||
"""Representation of a Monoprice amplifier zone."""
|
"""Representation of a Monoprice amplifier zone."""
|
||||||
|
|
||||||
def __init__(self, monoprice, sources, namespace, zone_id):
|
def __init__(self, monoprice, sources, namespace, zone_id):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import re
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([MpcHcDevice(name, url)], True)
|
add_entities([MpcHcDevice(name, url)], True)
|
||||||
|
|
||||||
|
|
||||||
class MpcHcDevice(MediaPlayerDevice):
|
class MpcHcDevice(MediaPlayerEntity):
|
||||||
"""Representation of a MPC-HC server."""
|
"""Representation of a MPC-HC server."""
|
||||||
|
|
||||||
def __init__(self, name, url):
|
def __init__(self, name, url):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import os
|
||||||
import mpd
|
import mpd
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
MEDIA_TYPE_PLAYLIST,
|
MEDIA_TYPE_PLAYLIST,
|
||||||
|
@ -81,7 +81,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([device], True)
|
add_entities([device], True)
|
||||||
|
|
||||||
|
|
||||||
class MpdDevice(MediaPlayerDevice):
|
class MpdDevice(MediaPlayerEntity):
|
||||||
"""Representation of a MPD server."""
|
"""Representation of a MPD server."""
|
||||||
|
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from nad_receiver import NADReceiver, NADReceiverTCP, NADReceiverTelnet
|
from nad_receiver import NADReceiver, NADReceiverTCP, NADReceiverTelnet
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -105,7 +105,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class NAD(MediaPlayerDevice):
|
class NAD(MediaPlayerEntity):
|
||||||
"""Representation of a NAD Receiver."""
|
"""Representation of a NAD Receiver."""
|
||||||
|
|
||||||
def __init__(self, name, nad_receiver, min_volume, max_volume, source_dict):
|
def __init__(self, name, nad_receiver, min_volume, max_volume, source_dict):
|
||||||
|
@ -221,7 +221,7 @@ class NAD(MediaPlayerDevice):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class NADtcp(MediaPlayerDevice):
|
class NADtcp(MediaPlayerEntity):
|
||||||
"""Representation of a NAD Digital amplifier."""
|
"""Representation of a NAD Digital amplifier."""
|
||||||
|
|
||||||
def __init__(self, name, nad_device, min_volume, max_volume, volume_step):
|
def __init__(self, name, nad_device, min_volume, max_volume, volume_step):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import eiscp
|
||||||
from eiscp import eISCP
|
from eiscp import eISCP
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SUPPORT_PLAY,
|
SUPPORT_PLAY,
|
||||||
|
@ -211,7 +211,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(hosts, True)
|
add_entities(hosts, True)
|
||||||
|
|
||||||
|
|
||||||
class OnkyoDevice(MediaPlayerDevice):
|
class OnkyoDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Onkyo device."""
|
"""Representation of an Onkyo device."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
|
|
||||||
from openhomedevice.Device import Device
|
from openhomedevice.Device import Device
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class OpenhomeDevice(MediaPlayerDevice):
|
class OpenhomeDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Openhome device."""
|
"""Representation of an Openhome device."""
|
||||||
|
|
||||||
def __init__(self, hass, device):
|
def __init__(self, hass, device):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
from panacotta import PanasonicBD
|
from panacotta import PanasonicBD
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
SUPPORT_PLAY,
|
SUPPORT_PLAY,
|
||||||
|
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([PanasonicBluRay(conf[CONF_HOST], conf[CONF_NAME])])
|
add_entities([PanasonicBluRay(conf[CONF_HOST], conf[CONF_NAME])])
|
||||||
|
|
||||||
|
|
||||||
class PanasonicBluRay(MediaPlayerDevice):
|
class PanasonicBluRay(MediaPlayerEntity):
|
||||||
"""Representation of a Panasonic Blu-ray device."""
|
"""Representation of a Panasonic Blu-ray device."""
|
||||||
|
|
||||||
def __init__(self, ip, name):
|
def __init__(self, ip, name):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from urllib.request import URLError
|
||||||
|
|
||||||
from panasonic_viera import EncryptionRequired, Keys, RemoteControl, SOAPError
|
from panasonic_viera import EncryptionRequired, Keys, RemoteControl, SOAPError
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_URL,
|
MEDIA_TYPE_URL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -68,7 +68,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
async_add_entities([tv_device])
|
async_add_entities([tv_device])
|
||||||
|
|
||||||
|
|
||||||
class PanasonicVieraTVDevice(MediaPlayerDevice):
|
class PanasonicVieraTVDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Panasonic Viera TV."""
|
"""Representation of a Panasonic Viera TV."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -9,7 +9,7 @@ import signal
|
||||||
import pexpect
|
import pexpect
|
||||||
|
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -72,12 +72,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([pandora])
|
add_entities([pandora])
|
||||||
|
|
||||||
|
|
||||||
class PandoraMediaPlayer(MediaPlayerDevice):
|
class PandoraMediaPlayer(MediaPlayerEntity):
|
||||||
"""A media player that uses the Pianobar interface to Pandora."""
|
"""A media player that uses the Pianobar interface to Pandora."""
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
"""Initialize the Pandora device."""
|
"""Initialize the Pandora device."""
|
||||||
MediaPlayerDevice.__init__(self)
|
|
||||||
self._name = name
|
self._name = name
|
||||||
self._player_state = STATE_OFF
|
self._player_state = STATE_OFF
|
||||||
self._station = ""
|
self._station = ""
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
from haphilipsjs import PhilipsTV
|
from haphilipsjs import PhilipsTV
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -82,7 +82,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([PhilipsTVMediaPlayer(tvapi, name, on_script)])
|
add_entities([PhilipsTVMediaPlayer(tvapi, name, on_script)])
|
||||||
|
|
||||||
|
|
||||||
class PhilipsTVMediaPlayer(MediaPlayerDevice):
|
class PhilipsTVMediaPlayer(MediaPlayerEntity):
|
||||||
"""Representation of a Philips TV exposing the JointSpace API."""
|
"""Representation of a Philips TV exposing the JointSpace API."""
|
||||||
|
|
||||||
def __init__(self, tv, name, on_script):
|
def __init__(self, tv, name, on_script):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from pypjlink import MUTE_AUDIO, Projector
|
||||||
from pypjlink.projector import ProjectorError
|
from pypjlink.projector import ProjectorError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -70,7 +70,7 @@ def format_input_source(input_source_name, input_source_number):
|
||||||
return f"{input_source_name} {input_source_number}"
|
return f"{input_source_name} {input_source_number}"
|
||||||
|
|
||||||
|
|
||||||
class PjLinkDevice(MediaPlayerDevice):
|
class PjLinkDevice(MediaPlayerEntity):
|
||||||
"""Representation of a PJLink device."""
|
"""Representation of a PJLink device."""
|
||||||
|
|
||||||
def __init__(self, host, port, name, encoding, password):
|
def __init__(self, host, port, name, encoding, password):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
import plexapi.exceptions
|
import plexapi.exceptions
|
||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
|
||||||
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN, MediaPlayerDevice
|
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_EPISODE,
|
MEDIA_TYPE_EPISODE,
|
||||||
MEDIA_TYPE_MOVIE,
|
MEDIA_TYPE_MOVIE,
|
||||||
|
@ -88,7 +88,7 @@ def _async_add_entities(
|
||||||
async_add_entities(entities, True)
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
class PlexMediaPlayer(MediaPlayerDevice):
|
class PlexMediaPlayer(MediaPlayerEntity):
|
||||||
"""Representation of a Plex device."""
|
"""Representation of a Plex device."""
|
||||||
|
|
||||||
def __init__(self, plex_server, device, session=None):
|
def __init__(self, plex_server, device, session=None):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
from pyps4_2ndscreen.errors import NotReady, PSDataIncomplete
|
from pyps4_2ndscreen.errors import NotReady, PSDataIncomplete
|
||||||
import pyps4_2ndscreen.ps4 as pyps4
|
import pyps4_2ndscreen.ps4 as pyps4
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
ATTR_MEDIA_CONTENT_TYPE,
|
ATTR_MEDIA_CONTENT_TYPE,
|
||||||
ATTR_MEDIA_TITLE,
|
ATTR_MEDIA_TITLE,
|
||||||
|
@ -69,7 +69,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
async_add_entities(device_list, update_before_add=True)
|
async_add_entities(device_list, update_before_add=True)
|
||||||
|
|
||||||
|
|
||||||
class PS4Device(MediaPlayerDevice):
|
class PS4Device(MediaPlayerEntity):
|
||||||
"""Representation of a PS4."""
|
"""Representation of a PS4."""
|
||||||
|
|
||||||
def __init__(self, config, name, host, region, ps4, creds):
|
def __init__(self, config, name, host, region, ps4, creds):
|
||||||
|
|
|
@ -7,7 +7,7 @@ from requests.exceptions import (
|
||||||
)
|
)
|
||||||
from roku import RokuException
|
from roku import RokuException
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -45,7 +45,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
async_add_entities([RokuDevice(roku)], True)
|
async_add_entities([RokuDevice(roku)], True)
|
||||||
|
|
||||||
|
|
||||||
class RokuDevice(MediaPlayerDevice):
|
class RokuDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Roku device on the network."""
|
"""Representation of a Roku device on the network."""
|
||||||
|
|
||||||
def __init__(self, roku):
|
def __init__(self, roku):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from russound_rio import Russound
|
from russound_rio import Russound
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
|
@ -73,7 +73,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class RussoundZoneDevice(MediaPlayerDevice):
|
class RussoundZoneDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Russound Zone."""
|
"""Representation of a Russound Zone."""
|
||||||
|
|
||||||
def __init__(self, russ, zone_id, name, sources):
|
def __init__(self, russ, zone_id, name, sources):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from russound import russound
|
from russound import russound
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -68,7 +68,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
_LOGGER.error("Not connected to %s:%s", host, port)
|
_LOGGER.error("Not connected to %s:%s", host, port)
|
||||||
|
|
||||||
|
|
||||||
class RussoundRNETDevice(MediaPlayerDevice):
|
class RussoundRNETDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Russound RNET device."""
|
"""Representation of a Russound RNET device."""
|
||||||
|
|
||||||
def __init__(self, hass, russ, sources, zone_id, extra):
|
def __init__(self, hass, russ, sources, zone_id, extra):
|
||||||
|
|
|
@ -4,7 +4,7 @@ from datetime import timedelta
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import DEVICE_CLASS_TV, MediaPlayerDevice
|
from homeassistant.components.media_player import DEVICE_CLASS_TV, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -81,7 +81,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
async_add_entities([SamsungTVDevice(bridge, config_entry, on_script)])
|
async_add_entities([SamsungTVDevice(bridge, config_entry, on_script)])
|
||||||
|
|
||||||
|
|
||||||
class SamsungTVDevice(MediaPlayerDevice):
|
class SamsungTVDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Samsung TV."""
|
"""Representation of a Samsung TV."""
|
||||||
|
|
||||||
def __init__(self, bridge, config_entry, on_script):
|
def __init__(self, bridge, config_entry, on_script):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from sisyphus_control import Track
|
from sisyphus_control import Track
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -56,7 +56,7 @@ async def async_setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([SisyphusPlayer(table_holder.name, host, table)], True)
|
add_entities([SisyphusPlayer(table_holder.name, host, table)], True)
|
||||||
|
|
||||||
|
|
||||||
class SisyphusPlayer(MediaPlayerDevice):
|
class SisyphusPlayer(MediaPlayerEntity):
|
||||||
"""Representation of a Sisyphus table as a media player device."""
|
"""Representation of a Sisyphus table as a media player device."""
|
||||||
|
|
||||||
def __init__(self, name, host, table):
|
def __init__(self, name, host, table):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import snapcast.control
|
||||||
from snapcast.control.server import CONTROL_PORT
|
from snapcast.control.server import CONTROL_PORT
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_VOLUME_MUTE,
|
SUPPORT_VOLUME_MUTE,
|
||||||
|
@ -110,7 +110,7 @@ async def handle_set_latency(entity, service_call):
|
||||||
await entity.async_set_latency(service_call.data[ATTR_LATENCY])
|
await entity.async_set_latency(service_call.data[ATTR_LATENCY])
|
||||||
|
|
||||||
|
|
||||||
class SnapcastGroupDevice(MediaPlayerDevice):
|
class SnapcastGroupDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Snapcast group device."""
|
"""Representation of a Snapcast group device."""
|
||||||
|
|
||||||
def __init__(self, group, uid_part):
|
def __init__(self, group, uid_part):
|
||||||
|
@ -200,7 +200,7 @@ class SnapcastGroupDevice(MediaPlayerDevice):
|
||||||
await self._group.restore()
|
await self._group.restore()
|
||||||
|
|
||||||
|
|
||||||
class SnapcastClientDevice(MediaPlayerDevice):
|
class SnapcastClientDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Snapcast client device."""
|
"""Representation of a Snapcast client device."""
|
||||||
|
|
||||||
def __init__(self, client, uid_part):
|
def __init__(self, client, uid_part):
|
||||||
|
|
|
@ -13,7 +13,7 @@ from songpal import (
|
||||||
)
|
)
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
|
@ -117,7 +117,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SongpalDevice(MediaPlayerDevice):
|
class SongpalDevice(MediaPlayerEntity):
|
||||||
"""Class representing a Songpal device."""
|
"""Class representing a Songpal device."""
|
||||||
|
|
||||||
def __init__(self, name, endpoint, poll=False):
|
def __init__(self, name, endpoint, poll=False):
|
||||||
|
|
|
@ -13,7 +13,7 @@ import pysonos.music_library
|
||||||
import pysonos.snapshot
|
import pysonos.snapshot
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
ATTR_MEDIA_ENQUEUE,
|
ATTR_MEDIA_ENQUEUE,
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
|
@ -338,7 +338,7 @@ def _timespan_secs(timespan):
|
||||||
return sum(60 ** x[0] * int(x[1]) for x in enumerate(reversed(timespan.split(":"))))
|
return sum(60 ** x[0] * int(x[1]) for x in enumerate(reversed(timespan.split(":"))))
|
||||||
|
|
||||||
|
|
||||||
class SonosEntity(MediaPlayerDevice):
|
class SonosEntity(MediaPlayerEntity):
|
||||||
"""Representation of a Sonos entity."""
|
"""Representation of a Sonos entity."""
|
||||||
|
|
||||||
def __init__(self, player):
|
def __init__(self, player):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import re
|
||||||
from libsoundtouch import soundtouch_device
|
from libsoundtouch import soundtouch_device
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -184,7 +184,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SoundTouchDevice(MediaPlayerDevice):
|
class SoundTouchDevice(MediaPlayerEntity):
|
||||||
"""Representation of a SoundTouch Bose device."""
|
"""Representation of a SoundTouch Bose device."""
|
||||||
|
|
||||||
def __init__(self, name, config):
|
def __init__(self, name, config):
|
||||||
|
|
|
@ -9,7 +9,7 @@ from aiohttp import ClientError
|
||||||
from spotipy import Spotify, SpotifyException
|
from spotipy import Spotify, SpotifyException
|
||||||
from yarl import URL
|
from yarl import URL
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
MEDIA_TYPE_PLAYLIST,
|
MEDIA_TYPE_PLAYLIST,
|
||||||
|
@ -90,7 +90,7 @@ def spotify_exception_handler(func):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
class SpotifyMediaPlayer(MediaPlayerDevice):
|
class SpotifyMediaPlayer(MediaPlayerEntity):
|
||||||
"""Representation of a Spotify controller."""
|
"""Representation of a Spotify controller."""
|
||||||
|
|
||||||
def __init__(self, session, spotify: Spotify, me: dict, user_id: str, name: str):
|
def __init__(self, session, spotify: Spotify, me: dict, user_id: str, name: str):
|
||||||
|
|
|
@ -9,7 +9,7 @@ import aiohttp
|
||||||
import async_timeout
|
import async_timeout
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
ATTR_MEDIA_ENQUEUE,
|
ATTR_MEDIA_ENQUEUE,
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
|
@ -147,7 +147,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities(players)
|
async_add_entities(players)
|
||||||
|
|
||||||
async def async_service_handler(service):
|
async def async_service_handler(service):
|
||||||
"""Map services to methods on MediaPlayerDevice."""
|
"""Map services to methods on MediaPlayerEntity."""
|
||||||
method = SERVICE_TO_METHOD.get(service.service)
|
method = SERVICE_TO_METHOD.get(service.service)
|
||||||
if not method:
|
if not method:
|
||||||
return
|
return
|
||||||
|
@ -245,7 +245,7 @@ class LogitechMediaServer:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class SqueezeBoxDevice(MediaPlayerDevice):
|
class SqueezeBoxDevice(MediaPlayerEntity):
|
||||||
"""Representation of a SqueezeBox device."""
|
"""Representation of a SqueezeBox device."""
|
||||||
|
|
||||||
def __init__(self, lms, player_id, name):
|
def __init__(self, lms, player_id, name):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -88,7 +88,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([UERadioDevice(session, player_id, player_name)])
|
add_entities([UERadioDevice(session, player_id, player_name)])
|
||||||
|
|
||||||
|
|
||||||
class UERadioDevice(MediaPlayerDevice):
|
class UERadioDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Logitech UE Smart Radio device."""
|
"""Representation of a Logitech UE Smart Radio device."""
|
||||||
|
|
||||||
def __init__(self, session, player_id, player_name):
|
def __init__(self, session, player_id, player_name):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
ATTR_APP_ID,
|
ATTR_APP_ID,
|
||||||
ATTR_APP_NAME,
|
ATTR_APP_NAME,
|
||||||
|
@ -116,7 +116,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities([player])
|
async_add_entities([player])
|
||||||
|
|
||||||
|
|
||||||
class UniversalMediaPlayer(MediaPlayerDevice):
|
class UniversalMediaPlayer(MediaPlayerEntity):
|
||||||
"""Representation of an universal media player."""
|
"""Representation of an universal media player."""
|
||||||
|
|
||||||
def __init__(self, hass, name, children, commands, attributes, state_template=None):
|
def __init__(self, hass, name, children, commands, attributes, state_template=None):
|
||||||
|
|
|
@ -10,7 +10,7 @@ from pyvizio.const import APP_HOME, APPS, INPUT_APPS, NO_APP_RUNNING, UNKNOWN_AP
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
DEVICE_CLASS_SPEAKER,
|
DEVICE_CLASS_SPEAKER,
|
||||||
SUPPORT_SELECT_SOUND_MODE,
|
SUPPORT_SELECT_SOUND_MODE,
|
||||||
MediaPlayerDevice,
|
MediaPlayerEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
@ -114,7 +114,7 @@ async def async_setup_entry(
|
||||||
async_add_entities([entity], update_before_add=True)
|
async_add_entities([entity], update_before_add=True)
|
||||||
|
|
||||||
|
|
||||||
class VizioDevice(MediaPlayerDevice):
|
class VizioDevice(MediaPlayerEntity):
|
||||||
"""Media Player implementation which performs REST requests to device."""
|
"""Media Player implementation which performs REST requests to device."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import vlc
|
import vlc
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class VlcDevice(MediaPlayerDevice):
|
class VlcDevice(MediaPlayerEntity):
|
||||||
"""Representation of a vlc player."""
|
"""Representation of a vlc player."""
|
||||||
|
|
||||||
def __init__(self, name, arguments):
|
def __init__(self, name, arguments):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from python_telnet_vlc import ConnectionError as ConnErr, VLCTelnet
|
from python_telnet_vlc import ConnectionError as ConnErr, VLCTelnet
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_CLEAR_PLAYLIST,
|
SUPPORT_CLEAR_PLAYLIST,
|
||||||
|
@ -76,7 +76,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class VlcDevice(MediaPlayerDevice):
|
class VlcDevice(MediaPlayerEntity):
|
||||||
"""Representation of a vlc player."""
|
"""Representation of a vlc player."""
|
||||||
|
|
||||||
def __init__(self, name, host, port, passwd):
|
def __init__(self, name, host, port, passwd):
|
||||||
|
|
|
@ -11,7 +11,7 @@ import socket
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_CLEAR_PLAYLIST,
|
SUPPORT_CLEAR_PLAYLIST,
|
||||||
|
@ -104,7 +104,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
|
|
||||||
class Volumio(MediaPlayerDevice):
|
class Volumio(MediaPlayerEntity):
|
||||||
"""Volumio Player Object."""
|
"""Volumio Player Object."""
|
||||||
|
|
||||||
def __init__(self, name, host, port, hass):
|
def __init__(self, name, host, port, hass):
|
||||||
|
|
|
@ -8,7 +8,7 @@ from aiopylgtv import PyLGTVCmdException, PyLGTVPairException, WebOsClient
|
||||||
from websockets.exceptions import ConnectionClosed
|
from websockets.exceptions import ConnectionClosed
|
||||||
|
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.components.media_player import DEVICE_CLASS_TV, MediaPlayerDevice
|
from homeassistant.components.media_player import DEVICE_CLASS_TV, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -109,7 +109,7 @@ def cmd(func):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
class LgWebOSMediaPlayerEntity(MediaPlayerDevice):
|
class LgWebOSMediaPlayerEntity(MediaPlayerEntity):
|
||||||
"""Representation of a LG webOS Smart TV."""
|
"""Representation of a LG webOS Smart TV."""
|
||||||
|
|
||||||
def __init__(self, client: WebOsClient, name: str, customize, on_script=None):
|
def __init__(self, client: WebOsClient, name: str, customize, on_script=None):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import pymitv
|
import pymitv
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_TURN_OFF,
|
SUPPORT_TURN_OFF,
|
||||||
SUPPORT_TURN_ON,
|
SUPPORT_TURN_ON,
|
||||||
|
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(XiaomiTV(tv, DEFAULT_NAME) for tv in pymitv.Discover().scan())
|
add_entities(XiaomiTV(tv, DEFAULT_NAME) for tv in pymitv.Discover().scan())
|
||||||
|
|
||||||
|
|
||||||
class XiaomiTV(MediaPlayerDevice):
|
class XiaomiTV(MediaPlayerEntity):
|
||||||
"""Represent the Xiaomi TV for Home Assistant."""
|
"""Represent the Xiaomi TV for Home Assistant."""
|
||||||
|
|
||||||
def __init__(self, ip, name):
|
def __init__(self, ip, name):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import requests
|
||||||
import rxv
|
import rxv
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -153,7 +153,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class YamahaDevice(MediaPlayerDevice):
|
class YamahaDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Yamaha device."""
|
"""Representation of a Yamaha device."""
|
||||||
|
|
||||||
def __init__(self, name, receiver, source_ignore, source_names, zone_names):
|
def __init__(self, name, receiver, source_ignore, source_names, zone_names):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import socket
|
||||||
import pymusiccast
|
import pymusiccast
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
|
@ -105,7 +105,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
known_hosts.remove(reg_host)
|
known_hosts.remove(reg_host)
|
||||||
|
|
||||||
|
|
||||||
class YamahaDevice(MediaPlayerDevice):
|
class YamahaDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Yamaha MusicCast device."""
|
"""Representation of a Yamaha MusicCast device."""
|
||||||
|
|
||||||
def __init__(self, recv, zone):
|
def __init__(self, recv, zone):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import socket
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from ziggo_mediabox_xl import ZiggoMediaboxXL
|
from ziggo_mediabox_xl import ZiggoMediaboxXL
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
|
@ -92,7 +92,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(hosts, True)
|
add_entities(hosts, True)
|
||||||
|
|
||||||
|
|
||||||
class ZiggoMediaboxXLDevice(MediaPlayerDevice):
|
class ZiggoMediaboxXLDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Ziggo Mediabox XL Device."""
|
"""Representation of a Ziggo Mediabox XL Device."""
|
||||||
|
|
||||||
def __init__(self, mediabox, host, name, available):
|
def __init__(self, mediabox, host, name, available):
|
||||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.const import (
|
||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
class AsyncMediaPlayer(mp.MediaPlayerDevice):
|
class AsyncMediaPlayer(mp.MediaPlayerEntity):
|
||||||
"""Async media player test class."""
|
"""Async media player test class."""
|
||||||
|
|
||||||
def __init__(self, hass):
|
def __init__(self, hass):
|
||||||
|
@ -65,7 +65,7 @@ class AsyncMediaPlayer(mp.MediaPlayerDevice):
|
||||||
self._state = STATE_OFF
|
self._state = STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
class SyncMediaPlayer(mp.MediaPlayerDevice):
|
class SyncMediaPlayer(mp.MediaPlayerEntity):
|
||||||
"""Sync media player test class."""
|
"""Sync media player test class."""
|
||||||
|
|
||||||
def __init__(self, hass):
|
def __init__(self, hass):
|
||||||
|
|
|
@ -3,6 +3,7 @@ import base64
|
||||||
|
|
||||||
from asynctest import patch
|
from asynctest import patch
|
||||||
|
|
||||||
|
from homeassistant.components import media_player
|
||||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ async def test_get_image(hass, hass_ws_client, caplog):
|
||||||
client = await hass_ws_client(hass)
|
client = await hass_ws_client(hass)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||||
"async_get_media_image",
|
"async_get_media_image",
|
||||||
return_value=mock_coro((b"image", "image/jpeg")),
|
return_value=mock_coro((b"image", "image/jpeg")),
|
||||||
):
|
):
|
||||||
|
@ -53,7 +54,7 @@ async def test_get_image_http(hass, aiohttp_client):
|
||||||
client = await aiohttp_client(hass.http.app)
|
client = await aiohttp_client(hass.http.app)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||||
"async_get_media_image",
|
"async_get_media_image",
|
||||||
return_value=(b"image", "image/jpeg"),
|
return_value=(b"image", "image/jpeg"),
|
||||||
):
|
):
|
||||||
|
@ -66,7 +67,7 @@ async def test_get_image_http(hass, aiohttp_client):
|
||||||
async def test_get_image_http_remote(hass, aiohttp_client):
|
async def test_get_image_http_remote(hass, aiohttp_client):
|
||||||
"""Test get image url via http command."""
|
"""Test get image url via http command."""
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||||
"media_image_remotely_accessible",
|
"media_image_remotely_accessible",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
):
|
):
|
||||||
|
@ -80,7 +81,7 @@ async def test_get_image_http_remote(hass, aiohttp_client):
|
||||||
client = await aiohttp_client(hass.http.app)
|
client = await aiohttp_client(hass.http.app)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||||
"async_get_media_image",
|
"async_get_media_image",
|
||||||
return_value=(b"image", "image/jpeg"),
|
return_value=(b"image", "image/jpeg"),
|
||||||
):
|
):
|
||||||
|
@ -88,3 +89,13 @@ async def test_get_image_http_remote(hass, aiohttp_client):
|
||||||
content = await resp.read()
|
content = await resp.read()
|
||||||
|
|
||||||
assert content == b"image"
|
assert content == b"image"
|
||||||
|
|
||||||
|
|
||||||
|
def test_deprecated_base_class(caplog):
|
||||||
|
"""Test deprecated base class."""
|
||||||
|
|
||||||
|
class CustomMediaPlayer(media_player.MediaPlayerDevice):
|
||||||
|
pass
|
||||||
|
|
||||||
|
CustomMediaPlayer()
|
||||||
|
assert "MediaPlayerDevice is deprecated, modify CustomMediaPlayer" in caplog.text
|
||||||
|
|
|
@ -22,7 +22,7 @@ def validate_config(config):
|
||||||
return validated_config
|
return validated_config
|
||||||
|
|
||||||
|
|
||||||
class MockMediaPlayer(media_player.MediaPlayerDevice):
|
class MockMediaPlayer(media_player.MediaPlayerEntity):
|
||||||
"""Mock media player for testing."""
|
"""Mock media player for testing."""
|
||||||
|
|
||||||
def __init__(self, hass, name):
|
def __init__(self, hass, name):
|
||||||
|
|
Loading…
Reference in New Issue