mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Improve type hint in emby media-player entity (#77136)
This commit is contained in:
parent
6693cfd036
commit
d7685f869a
@ -141,6 +141,8 @@ async def async_setup_platform(
|
|||||||
class EmbyDevice(MediaPlayerEntity):
|
class EmbyDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Emby device."""
|
"""Representation of an Emby device."""
|
||||||
|
|
||||||
|
_attr_should_poll = False
|
||||||
|
|
||||||
def __init__(self, emby, device_id):
|
def __init__(self, emby, device_id):
|
||||||
"""Initialize the Emby device."""
|
"""Initialize the Emby device."""
|
||||||
_LOGGER.debug("New Emby Device initialized with ID: %s", device_id)
|
_LOGGER.debug("New Emby Device initialized with ID: %s", device_id)
|
||||||
@ -148,11 +150,11 @@ class EmbyDevice(MediaPlayerEntity):
|
|||||||
self.device_id = device_id
|
self.device_id = device_id
|
||||||
self.device = self.emby.devices[self.device_id]
|
self.device = self.emby.devices[self.device_id]
|
||||||
|
|
||||||
self._available = True
|
|
||||||
|
|
||||||
self.media_status_last_position = None
|
self.media_status_last_position = None
|
||||||
self.media_status_received = None
|
self.media_status_received = None
|
||||||
|
|
||||||
|
self._attr_unique_id = device_id
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Register callback."""
|
"""Register callback."""
|
||||||
self.emby.add_update_callback(self.async_update_callback, self.device_id)
|
self.emby.add_update_callback(self.async_update_callback, self.device_id)
|
||||||
@ -172,19 +174,9 @@ class EmbyDevice(MediaPlayerEntity):
|
|||||||
|
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
@property
|
def set_available(self, value: bool) -> None:
|
||||||
def available(self):
|
|
||||||
"""Return True if entity is available."""
|
|
||||||
return self._available
|
|
||||||
|
|
||||||
def set_available(self, value):
|
|
||||||
"""Set available property."""
|
"""Set available property."""
|
||||||
self._available = value
|
self._attr_available = value
|
||||||
|
|
||||||
@property
|
|
||||||
def unique_id(self):
|
|
||||||
"""Return the id of this emby client."""
|
|
||||||
return self.device_id
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supports_remote_control(self):
|
def supports_remote_control(self):
|
||||||
@ -196,11 +188,6 @@ class EmbyDevice(MediaPlayerEntity):
|
|||||||
"""Return the name of the device."""
|
"""Return the name of the device."""
|
||||||
return f"Emby {self.device.name}" or DEVICE_DEFAULT_NAME
|
return f"Emby {self.device.name}" or DEVICE_DEFAULT_NAME
|
||||||
|
|
||||||
@property
|
|
||||||
def should_poll(self):
|
|
||||||
"""Return True if entity has to be polled for state."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user