Rename MediaPlayerDevice to MediaPlayerEntity (#34592)

pull/34689/head
Erik Montnemery 2020-04-25 18:00:57 +02:00 committed by GitHub
parent 56f7c3b55c
commit 62bc02fdda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
75 changed files with 178 additions and 156 deletions

View File

@ -16,7 +16,7 @@ from androidtv.constants import APPS, KEYS
from androidtv.exceptions import LockNotAcquiredException
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 (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
@ -373,7 +373,7 @@ def adb_decorator(override_available=False):
return _adb_decorator
class ADBDevice(MediaPlayerDevice):
class ADBDevice(MediaPlayerEntity):
"""Representation of an Android TV or Fire TV device."""
def __init__(

View File

@ -4,7 +4,7 @@ import logging
import anthemav
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 (
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
@ -79,7 +79,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([device])
class AnthemAVR(MediaPlayerDevice):
class AnthemAVR(MediaPlayerEntity):
"""Entity reading values from Anthem AVR protocol."""
def __init__(self, avr, name):

View File

@ -3,7 +3,7 @@ import logging
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 (
MEDIA_TYPE_MUSIC,
MEDIA_TYPE_TVSHOW,
@ -76,7 +76,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([entity])
class AppleTvDevice(MediaPlayerDevice):
class AppleTvDevice(MediaPlayerEntity):
"""Representation of an Apple TV device."""
def __init__(self, atv, name, power):

View File

@ -4,7 +4,7 @@ import logging
import sharp_aquos_rc
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 (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
@ -121,7 +121,7 @@ def _retry(func):
return wrapper
class SharpAquosTVDevice(MediaPlayerDevice):
class SharpAquosTVDevice(MediaPlayerEntity):
"""Representation of a Aquos TV."""
def __init__(self, name, remote, power_on_enabled=False):

View File

@ -6,7 +6,7 @@ from arcam.fmj import DecodeMode2CH, DecodeModeMCH, IncomingAudioFormat, SourceC
from arcam.fmj.state import State
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_SELECT_SOUND_MODE,
@ -63,7 +63,7 @@ async def async_setup_entry(
return True
class ArcamFmj(MediaPlayerDevice):
class ArcamFmj(MediaPlayerEntity):
"""Representation of a media device."""
def __init__(self, state: State, name: str, turn_on: Optional[ConfigType]):

View File

@ -6,7 +6,7 @@ from pyblackbird import get_blackbird
from serial import SerialException
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 (
SUPPORT_SELECT_SOURCE,
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."""
def __init__(self, blackbird, sources, zone_id, zone_name):

View File

@ -12,7 +12,7 @@ import async_timeout
import voluptuous as vol
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 (
ATTR_MEDIA_ENQUEUE,
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."""
def __init__(self, hass, host, port=None, name=None, init_callback=None):

View File

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.media_player import (
DEVICE_CLASS_TV,
PLATFORM_SCHEMA,
MediaPlayerDevice,
MediaPlayerEntity,
)
from homeassistant.components.media_player.const import (
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."""
def __init__(self, client, name, pin, unique_id, device_info, ignored_sources):

View File

@ -12,7 +12,7 @@ from pychromecast.socket_client import (
)
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 (
MEDIA_TYPE_MOVIE,
MEDIA_TYPE_MUSIC,
@ -171,7 +171,7 @@ async def _async_setup_platform(
hass.async_add_executor_job(setup_internal_discovery, hass)
class CastDevice(MediaPlayerDevice):
class CastDevice(MediaPlayerEntity):
"""Representation of a Cast device on the network.
This class is the holder of the pychromecast.Chromecast object and its

View File

@ -4,7 +4,7 @@ import logging
from pychannels import Channels
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 (
MEDIA_TYPE_CHANNEL,
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."""
def __init__(self, name, host, port):

View File

@ -6,7 +6,7 @@ import time
from clementineremote import ClementineRemote
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -67,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([ClementineDevice(client, config[CONF_NAME])])
class ClementineDevice(MediaPlayerDevice):
class ClementineDevice(MediaPlayerEntity):
"""Representation of Clementine Player."""
def __init__(self, client, name):

View File

@ -4,7 +4,7 @@ import logging
from pycmus import exceptions, remote
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 (
MEDIA_TYPE_MUSIC,
MEDIA_TYPE_PLAYLIST,
@ -72,7 +72,7 @@ def setup_platform(hass, config, add_entities, discover_info=None):
add_entities([cmus_remote], True)
class CmusDevice(MediaPlayerDevice):
class CmusDevice(MediaPlayerEntity):
"""Representation of a running cmus."""
# pylint: disable=no-member

View File

@ -1,5 +1,5 @@
"""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 (
MEDIA_TYPE_MOVIE,
MEDIA_TYPE_MUSIC,
@ -93,7 +93,7 @@ NETFLIX_PLAYER_SUPPORT = (
)
class AbstractDemoPlayer(MediaPlayerDevice):
class AbstractDemoPlayer(MediaPlayerEntity):
"""A demo media players."""
# We only implement the methods that we support

View File

@ -4,7 +4,7 @@ import telnetlib
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 (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
@ -86,7 +86,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([denon])
class DenonDevice(MediaPlayerDevice):
class DenonDevice(MediaPlayerEntity):
"""Representation of a Denon device."""
def __init__(self, name, host):

View File

@ -6,7 +6,7 @@ import logging
import denonavr
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 (
MEDIA_TYPE_CHANNEL,
MEDIA_TYPE_MUSIC,
@ -159,7 +159,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(receivers)
class DenonDevice(MediaPlayerDevice):
class DenonDevice(MediaPlayerEntity):
"""Representation of a Denon Media Player Device."""
def __init__(self, receiver):

View File

@ -4,7 +4,7 @@ from typing import Callable, List
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 (
MEDIA_TYPE_CHANNEL,
MEDIA_TYPE_MOVIE,
@ -77,7 +77,7 @@ async def async_setup_entry(
async_add_entities(entities, True)
class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerDevice):
class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerEntity):
"""Representation of a DirecTV receiver on the network."""
def __init__(self, *, dtv: DIRECTV, name: str, address: str = "0") -> None:
@ -141,7 +141,7 @@ class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerDevice):
return self._address
# MediaPlayerDevice properties and methods
# MediaPlayerEntity properties and methods
@property
def state(self):
"""Return the state of the device."""

View File

@ -11,7 +11,7 @@ from async_upnp_client.aiohttp import AiohttpNotifyServer, AiohttpSessionRequest
from async_upnp_client.profiles.dlna import DeviceState, DmrDevice
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 (
MEDIA_TYPE_CHANNEL,
MEDIA_TYPE_EPISODE,
@ -194,7 +194,7 @@ async def async_setup_platform(
async_add_entities([device], True)
class DlnaDmrDevice(MediaPlayerDevice):
class DlnaDmrDevice(MediaPlayerEntity):
"""Representation of a DLNA DMR device."""
def __init__(self, dmr_device, name=None):

View File

@ -2,7 +2,7 @@
from pdunehd import DuneHDPlayer
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 (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
@ -55,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([DuneHDPlayerEntity(DuneHDPlayer(host), name, sources)], True)
class DuneHDPlayerEntity(MediaPlayerDevice):
class DuneHDPlayerEntity(MediaPlayerEntity):
"""Implementation of the Dune HD player."""
def __init__(self, player, name, sources):

View File

@ -4,7 +4,7 @@ import logging
from pyemby import EmbyServer
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 (
MEDIA_TYPE_CHANNEL,
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)
class EmbyDevice(MediaPlayerDevice):
class EmbyDevice(MediaPlayerEntity):
"""Representation of an Emby device."""
def __init__(self, emby, device_id):

View File

@ -4,7 +4,7 @@ import logging
from openwebif.api import CreateDevice
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 (
MEDIA_TYPE_TVSHOW,
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)
class Enigma2Device(MediaPlayerDevice):
class Enigma2Device(MediaPlayerEntity):
"""Representation of an Enigma2 box."""
def __init__(self, name, device):

View File

@ -26,7 +26,7 @@ from epson_projector.const import (
)
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 (
SUPPORT_NEXT_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."""
def __init__(self, websession, name, host, port, encryption):

View File

@ -5,7 +5,7 @@ from afsapi import AFSAPI
import requests
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -94,7 +94,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
return False
class AFSAPIDevice(MediaPlayerDevice):
class AFSAPIDevice(MediaPlayerEntity):
"""Representation of a Frontier Silicon device on the network."""
def __init__(self, device_url, password, name):

View File

@ -7,7 +7,7 @@ import time
import voluptuous as vol
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -167,7 +167,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
setup_gpmdp(hass, config, code, add_entities)
class GPMDP(MediaPlayerDevice):
class GPMDP(MediaPlayerEntity):
"""Representation of a GPMDP."""
def __init__(self, name, url, code):

View File

@ -4,7 +4,7 @@ import logging
from gsp import GstreamerPlayer
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([GstreamerDevice(player, name)])
class GstreamerDevice(MediaPlayerDevice):
class GstreamerDevice(MediaPlayerEntity):
"""Representation of a Gstreamer device."""
def __init__(self, player, name):

View File

@ -4,7 +4,7 @@ import logging
import hkavr
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 (
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_entities, discover_info=None):
add_entities([avr_device], True)
class HkAvrDevice(MediaPlayerDevice):
class HkAvrDevice(MediaPlayerEntity):
"""Representation of a Harman Kardon AVR / JBL AVR TV."""
def __init__(self, avr):

View File

@ -22,7 +22,7 @@ from pycec.const import (
TYPE_TUNER,
)
from homeassistant.components.media_player import MediaPlayerDevice
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player.const import (
DOMAIN,
SUPPORT_NEXT_TRACK,
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(entities, True)
class CecPlayerDevice(CecDevice, MediaPlayerDevice):
class CecPlayerDevice(CecDevice, MediaPlayerEntity):
"""Representation of a HDMI device as a Media player."""
def __init__(self, device, logical) -> None:

View File

@ -6,7 +6,7 @@ from typing import Sequence
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 (
ATTR_MEDIA_ENQUEUE,
DOMAIN,
@ -85,7 +85,7 @@ def log_command_error(command: str):
return decorator
class HeosMediaPlayer(MediaPlayerDevice):
class HeosMediaPlayer(MediaPlayerEntity):
"""The HEOS player."""
def __init__(self, player):

View File

@ -10,7 +10,7 @@ from aiohomekit.model.characteristics import (
from aiohomekit.model.services import ServicesTypes
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 (
SUPPORT_PAUSE,
SUPPORT_PLAY,
@ -54,7 +54,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
conn.add_listener(async_add_service)
class HomeKitTelevision(HomeKitEntity, MediaPlayerDevice):
class HomeKitTelevision(HomeKitEntity, MediaPlayerEntity):
"""Representation of a HomeKit Controller Television."""
def get_characteristic_types(self):

View File

@ -7,7 +7,7 @@ from horimote.exceptions import AuthenticationError
import voluptuous as vol
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 (
MEDIA_TYPE_CHANNEL,
SUPPORT_NEXT_TRACK,
@ -78,7 +78,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([HorizonDevice(client, name, keys)], True)
class HorizonDevice(MediaPlayerDevice):
class HorizonDevice(MediaPlayerEntity):
"""Representation of a Horizon HD Recorder."""
def __init__(self, client, name, remote_keys):

View File

@ -4,7 +4,7 @@ import logging
import requests
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 (
MEDIA_TYPE_MUSIC,
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."""
def __init__(self, name, host, port, use_ssl, add_entities):
@ -408,7 +408,7 @@ class ItunesDevice(MediaPlayerDevice):
self.update_state(response)
class AirPlayDevice(MediaPlayerDevice):
class AirPlayDevice(MediaPlayerEntity):
"""Representation an AirPlay device via an iTunes API instance."""
def __init__(self, device_id, client):

View File

@ -23,7 +23,7 @@ from homeassistant.components.media_player import (
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP,
MediaPlayerDevice,
MediaPlayerEntity,
)
from homeassistant.const import (
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")
class KefMediaPlayer(MediaPlayerDevice):
class KefMediaPlayer(MediaPlayerEntity):
"""Kef Player Object."""
def __init__(

View File

@ -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, [])):
# Register the Kodi media_player services
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)
if not method:
return

View File

@ -14,7 +14,7 @@ import voluptuous as vol
from homeassistant.components.kodi import SERVICE_CALL_METHOD
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 (
MEDIA_TYPE_CHANNEL,
MEDIA_TYPE_MOVIE,
@ -248,7 +248,7 @@ def cmd(func):
return wrapper
class KodiDevice(MediaPlayerDevice):
class KodiDevice(MediaPlayerEntity):
"""Representation of a XBMC/Kodi device."""
def __init__(

View File

@ -7,7 +7,7 @@ from requests import RequestException
import voluptuous as vol
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 (
MEDIA_TYPE_CHANNEL,
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)
class LgTVDevice(MediaPlayerDevice):
class LgTVDevice(MediaPlayerEntity):
"""Representation of a LG TV."""
def __init__(self, client, name, on_action_script):

View File

@ -3,7 +3,7 @@ import logging
import temescal
from homeassistant.components.media_player import MediaPlayerDevice
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player.const import (
SUPPORT_SELECT_SOUND_MODE,
SUPPORT_SELECT_SOURCE,
@ -28,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([LGDevice(discovery_info)], True)
class LGDevice(MediaPlayerDevice):
class LGDevice(MediaPlayerEntity):
"""Representation of an LG soundbar device."""
def __init__(self, discovery_info):

View File

@ -337,8 +337,8 @@ async def async_unload_entry(hass, entry):
return await hass.data[DOMAIN].async_unload_entry(entry)
class MediaPlayerDevice(Entity):
"""ABC for media player devices."""
class MediaPlayerEntity(Entity):
"""ABC for media player entities."""
_access_token: Optional[str] = None
@ -924,3 +924,15 @@ async def websocket_handle_thumbnail(hass, connection, msg):
"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__,
)

View File

@ -4,7 +4,7 @@ import logging
from pymediaroom import PyMediaroomError, Remote, State, install_mediaroom_protocol
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 (
MEDIA_TYPE_CHANNEL,
SUPPORT_NEXT_TRACK,
@ -118,7 +118,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
_LOGGER.debug("Auto discovery installed")
class MediaroomDevice(MediaPlayerDevice):
class MediaroomDevice(MediaPlayerEntity):
"""Representation of a Mediaroom set-up-box on the network."""
def set_state(self, mediaroom_state):

View File

@ -4,7 +4,7 @@ import logging
from serial import SerialException
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 (
SUPPORT_SELECT_SOURCE,
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."""
def __init__(self, monoprice, sources, namespace, zone_id):

View File

@ -5,7 +5,7 @@ import re
import requests
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 (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([MpcHcDevice(name, url)], True)
class MpcHcDevice(MediaPlayerDevice):
class MpcHcDevice(MediaPlayerEntity):
"""Representation of a MPC-HC server."""
def __init__(self, name, url):

View File

@ -6,7 +6,7 @@ import os
import mpd
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 (
MEDIA_TYPE_MUSIC,
MEDIA_TYPE_PLAYLIST,
@ -81,7 +81,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([device], True)
class MpdDevice(MediaPlayerDevice):
class MpdDevice(MediaPlayerEntity):
"""Representation of a MPD server."""
# pylint: disable=no-member

View File

@ -4,7 +4,7 @@ import logging
from nad_receiver import NADReceiver, NADReceiverTCP, NADReceiverTelnet
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 (
SUPPORT_SELECT_SOURCE,
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."""
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."""
def __init__(self, name, nad_device, min_volume, max_volume, volume_step):

View File

@ -6,7 +6,7 @@ import eiscp
from eiscp import eISCP
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 (
DOMAIN,
SUPPORT_PLAY,
@ -211,7 +211,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(hosts, True)
class OnkyoDevice(MediaPlayerDevice):
class OnkyoDevice(MediaPlayerEntity):
"""Representation of an Onkyo device."""
def __init__(

View File

@ -3,7 +3,7 @@ import logging
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return True
class OpenhomeDevice(MediaPlayerDevice):
class OpenhomeDevice(MediaPlayerEntity):
"""Representation of an Openhome device."""
def __init__(self, hass, device):

View File

@ -5,7 +5,7 @@ import logging
from panacotta import PanasonicBD
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 (
SUPPORT_PAUSE,
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])])
class PanasonicBluRay(MediaPlayerDevice):
class PanasonicBluRay(MediaPlayerEntity):
"""Representation of a Panasonic Blu-ray device."""
def __init__(self, ip, name):

View File

@ -5,7 +5,7 @@ from urllib.request import URLError
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 (
MEDIA_TYPE_URL,
SUPPORT_NEXT_TRACK,
@ -68,7 +68,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities([tv_device])
class PanasonicVieraTVDevice(MediaPlayerDevice):
class PanasonicVieraTVDevice(MediaPlayerEntity):
"""Representation of a Panasonic Viera TV."""
def __init__(

View File

@ -9,7 +9,7 @@ import signal
import pexpect
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -72,12 +72,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([pandora])
class PandoraMediaPlayer(MediaPlayerDevice):
class PandoraMediaPlayer(MediaPlayerEntity):
"""A media player that uses the Pianobar interface to Pandora."""
def __init__(self, name):
"""Initialize the Pandora device."""
MediaPlayerDevice.__init__(self)
self._name = name
self._player_state = STATE_OFF
self._station = ""

View File

@ -5,7 +5,7 @@ import logging
from haphilipsjs import PhilipsTV
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 (
MEDIA_TYPE_CHANNEL,
SUPPORT_NEXT_TRACK,
@ -82,7 +82,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([PhilipsTVMediaPlayer(tvapi, name, on_script)])
class PhilipsTVMediaPlayer(MediaPlayerDevice):
class PhilipsTVMediaPlayer(MediaPlayerEntity):
"""Representation of a Philips TV exposing the JointSpace API."""
def __init__(self, tv, name, on_script):

View File

@ -5,7 +5,7 @@ from pypjlink import MUTE_AUDIO, Projector
from pypjlink.projector import ProjectorError
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 (
SUPPORT_SELECT_SOURCE,
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}"
class PjLinkDevice(MediaPlayerDevice):
class PjLinkDevice(MediaPlayerEntity):
"""Representation of a PJLink device."""
def __init__(self, host, port, name, encoding, password):

View File

@ -5,7 +5,7 @@ import logging
import plexapi.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 (
MEDIA_TYPE_EPISODE,
MEDIA_TYPE_MOVIE,
@ -88,7 +88,7 @@ def _async_add_entities(
async_add_entities(entities, True)
class PlexMediaPlayer(MediaPlayerDevice):
class PlexMediaPlayer(MediaPlayerEntity):
"""Representation of a Plex device."""
def __init__(self, plex_server, device, session=None):

View File

@ -5,7 +5,7 @@ import logging
from pyps4_2ndscreen.errors import NotReady, PSDataIncomplete
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 (
ATTR_MEDIA_CONTENT_TYPE,
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)
class PS4Device(MediaPlayerDevice):
class PS4Device(MediaPlayerEntity):
"""Representation of a PS4."""
def __init__(self, config, name, host, region, ps4, creds):

View File

@ -7,7 +7,7 @@ from requests.exceptions import (
)
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 (
MEDIA_TYPE_CHANNEL,
SUPPORT_NEXT_TRACK,
@ -45,7 +45,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities([RokuDevice(roku)], True)
class RokuDevice(MediaPlayerDevice):
class RokuDevice(MediaPlayerEntity):
"""Representation of a Roku device on the network."""
def __init__(self, roku):

View File

@ -4,7 +4,7 @@ import logging
from russound_rio import Russound
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_SELECT_SOURCE,
@ -73,7 +73,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(devices)
class RussoundZoneDevice(MediaPlayerDevice):
class RussoundZoneDevice(MediaPlayerEntity):
"""Representation of a Russound Zone."""
def __init__(self, russ, zone_id, name, sources):

View File

@ -4,7 +4,7 @@ import logging
from russound import russound
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 (
SUPPORT_SELECT_SOURCE,
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)
class RussoundRNETDevice(MediaPlayerDevice):
class RussoundRNETDevice(MediaPlayerEntity):
"""Representation of a Russound RNET device."""
def __init__(self, hass, russ, sources, zone_id, extra):

View File

@ -4,7 +4,7 @@ from datetime import timedelta
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 (
MEDIA_TYPE_CHANNEL,
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)])
class SamsungTVDevice(MediaPlayerDevice):
class SamsungTVDevice(MediaPlayerEntity):
"""Representation of a Samsung TV."""
def __init__(self, bridge, config_entry, on_script):

View File

@ -4,7 +4,7 @@ import logging
import aiohttp
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 (
SUPPORT_NEXT_TRACK,
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)
class SisyphusPlayer(MediaPlayerDevice):
class SisyphusPlayer(MediaPlayerEntity):
"""Representation of a Sisyphus table as a media player device."""
def __init__(self, name, host, table):

View File

@ -6,7 +6,7 @@ import snapcast.control
from snapcast.control.server import CONTROL_PORT
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 (
SUPPORT_SELECT_SOURCE,
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])
class SnapcastGroupDevice(MediaPlayerDevice):
class SnapcastGroupDevice(MediaPlayerEntity):
"""Representation of a Snapcast group device."""
def __init__(self, group, uid_part):
@ -200,7 +200,7 @@ class SnapcastGroupDevice(MediaPlayerDevice):
await self._group.restore()
class SnapcastClientDevice(MediaPlayerDevice):
class SnapcastClientDevice(MediaPlayerEntity):
"""Representation of a Snapcast client device."""
def __init__(self, client, uid_part):

View File

@ -13,7 +13,7 @@ from songpal import (
)
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 (
SUPPORT_SELECT_SOURCE,
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."""
def __init__(self, name, endpoint, poll=False):

View File

@ -13,7 +13,7 @@ import pysonos.music_library
import pysonos.snapshot
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 (
ATTR_MEDIA_ENQUEUE,
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(":"))))
class SonosEntity(MediaPlayerDevice):
class SonosEntity(MediaPlayerEntity):
"""Representation of a Sonos entity."""
def __init__(self, player):

View File

@ -5,7 +5,7 @@ import re
from libsoundtouch import soundtouch_device
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 (
SUPPORT_NEXT_TRACK,
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."""
def __init__(self, name, config):

View File

@ -9,7 +9,7 @@ from aiohttp import ClientError
from spotipy import Spotify, SpotifyException
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 (
MEDIA_TYPE_MUSIC,
MEDIA_TYPE_PLAYLIST,
@ -90,7 +90,7 @@ def spotify_exception_handler(func):
return wrapper
class SpotifyMediaPlayer(MediaPlayerDevice):
class SpotifyMediaPlayer(MediaPlayerEntity):
"""Representation of a Spotify controller."""
def __init__(self, session, spotify: Spotify, me: dict, user_id: str, name: str):

View File

@ -9,7 +9,7 @@ import aiohttp
import async_timeout
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 (
ATTR_MEDIA_ENQUEUE,
MEDIA_TYPE_MUSIC,
@ -147,7 +147,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(players)
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)
if not method:
return
@ -245,7 +245,7 @@ class LogitechMediaServer:
return False
class SqueezeBoxDevice(MediaPlayerDevice):
class SqueezeBoxDevice(MediaPlayerEntity):
"""Representation of a SqueezeBox device."""
def __init__(self, lms, player_id, name):

View File

@ -5,7 +5,7 @@ import logging
import requests
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 (
MEDIA_TYPE_MUSIC,
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)])
class UERadioDevice(MediaPlayerDevice):
class UERadioDevice(MediaPlayerEntity):
"""Representation of a Logitech UE Smart Radio device."""
def __init__(self, session, player_id, player_name):

View File

@ -4,7 +4,7 @@ import logging
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 (
ATTR_APP_ID,
ATTR_APP_NAME,
@ -116,7 +116,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([player])
class UniversalMediaPlayer(MediaPlayerDevice):
class UniversalMediaPlayer(MediaPlayerEntity):
"""Representation of an universal media player."""
def __init__(self, hass, name, children, commands, attributes, state_template=None):

View File

@ -10,7 +10,7 @@ from pyvizio.const import APP_HOME, APPS, INPUT_APPS, NO_APP_RUNNING, UNKNOWN_AP
from homeassistant.components.media_player import (
DEVICE_CLASS_SPEAKER,
SUPPORT_SELECT_SOUND_MODE,
MediaPlayerDevice,
MediaPlayerEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
@ -114,7 +114,7 @@ async def async_setup_entry(
async_add_entities([entity], update_before_add=True)
class VizioDevice(MediaPlayerDevice):
class VizioDevice(MediaPlayerEntity):
"""Media Player implementation which performs REST requests to device."""
def __init__(

View File

@ -4,7 +4,7 @@ import logging
import vlc
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 (
MEDIA_TYPE_MUSIC,
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."""
def __init__(self, name, arguments):

View File

@ -4,7 +4,7 @@ import logging
from python_telnet_vlc import ConnectionError as ConnErr, VLCTelnet
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 (
MEDIA_TYPE_MUSIC,
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."""
def __init__(self, name, host, port, passwd):

View File

@ -11,7 +11,7 @@ import socket
import aiohttp
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_CLEAR_PLAYLIST,
@ -104,7 +104,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([entity])
class Volumio(MediaPlayerDevice):
class Volumio(MediaPlayerEntity):
"""Volumio Player Object."""
def __init__(self, name, host, port, hass):

View File

@ -8,7 +8,7 @@ from aiopylgtv import PyLGTVCmdException, PyLGTVPairException, WebOsClient
from websockets.exceptions import ConnectionClosed
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 (
MEDIA_TYPE_CHANNEL,
SUPPORT_NEXT_TRACK,
@ -109,7 +109,7 @@ def cmd(func):
return wrapper
class LgWebOSMediaPlayerEntity(MediaPlayerDevice):
class LgWebOSMediaPlayerEntity(MediaPlayerEntity):
"""Representation of a LG webOS Smart TV."""
def __init__(self, client: WebOsClient, name: str, customize, on_script=None):

View File

@ -4,7 +4,7 @@ import logging
import pymitv
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 (
SUPPORT_TURN_OFF,
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())
class XiaomiTV(MediaPlayerDevice):
class XiaomiTV(MediaPlayerEntity):
"""Represent the Xiaomi TV for Home Assistant."""
def __init__(self, ip, name):

View File

@ -5,7 +5,7 @@ import requests
import rxv
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -153,7 +153,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices)
class YamahaDevice(MediaPlayerDevice):
class YamahaDevice(MediaPlayerEntity):
"""Representation of a Yamaha device."""
def __init__(self, name, receiver, source_ignore, source_names, zone_names):

View File

@ -5,7 +5,7 @@ import socket
import pymusiccast
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 (
MEDIA_TYPE_MUSIC,
SUPPORT_NEXT_TRACK,
@ -105,7 +105,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
known_hosts.remove(reg_host)
class YamahaDevice(MediaPlayerDevice):
class YamahaDevice(MediaPlayerEntity):
"""Representation of a Yamaha MusicCast device."""
def __init__(self, recv, zone):

View File

@ -5,7 +5,7 @@ import socket
import voluptuous as vol
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 (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
@ -92,7 +92,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(hosts, True)
class ZiggoMediaboxXLDevice(MediaPlayerDevice):
class ZiggoMediaboxXLDevice(MediaPlayerEntity):
"""Representation of a Ziggo Mediabox XL Device."""
def __init__(self, mediabox, host, name, available):

View File

@ -14,7 +14,7 @@ from homeassistant.const import (
from tests.common import get_test_home_assistant
class AsyncMediaPlayer(mp.MediaPlayerDevice):
class AsyncMediaPlayer(mp.MediaPlayerEntity):
"""Async media player test class."""
def __init__(self, hass):
@ -65,7 +65,7 @@ class AsyncMediaPlayer(mp.MediaPlayerDevice):
self._state = STATE_OFF
class SyncMediaPlayer(mp.MediaPlayerDevice):
class SyncMediaPlayer(mp.MediaPlayerEntity):
"""Sync media player test class."""
def __init__(self, hass):

View File

@ -3,6 +3,7 @@ import base64
from asynctest import patch
from homeassistant.components import media_player
from homeassistant.components.websocket_api.const import TYPE_RESULT
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)
with patch(
"homeassistant.components.media_player.MediaPlayerDevice."
"homeassistant.components.media_player.MediaPlayerEntity."
"async_get_media_image",
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)
with patch(
"homeassistant.components.media_player.MediaPlayerDevice."
"homeassistant.components.media_player.MediaPlayerEntity."
"async_get_media_image",
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):
"""Test get image url via http command."""
with patch(
"homeassistant.components.media_player.MediaPlayerDevice."
"homeassistant.components.media_player.MediaPlayerEntity."
"media_image_remotely_accessible",
return_value=True,
):
@ -80,7 +81,7 @@ async def test_get_image_http_remote(hass, aiohttp_client):
client = await aiohttp_client(hass.http.app)
with patch(
"homeassistant.components.media_player.MediaPlayerDevice."
"homeassistant.components.media_player.MediaPlayerEntity."
"async_get_media_image",
return_value=(b"image", "image/jpeg"),
):
@ -88,3 +89,13 @@ async def test_get_image_http_remote(hass, aiohttp_client):
content = await resp.read()
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

View File

@ -22,7 +22,7 @@ def validate_config(config):
return validated_config
class MockMediaPlayer(media_player.MediaPlayerDevice):
class MockMediaPlayer(media_player.MediaPlayerEntity):
"""Mock media player for testing."""
def __init__(self, hass, name):