Use shorthand attributes in Plex (#99769)

Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
Joost Lekkerkerker 2023-09-07 13:55:16 +02:00 committed by GitHub
parent 8a4cd913b8
commit 40a3d97230
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View file

@ -117,6 +117,10 @@ def _async_add_entities(hass, registry, async_add_entities, server_id, new_entit
class PlexMediaPlayer(MediaPlayerEntity):
"""Representation of a Plex device."""
_attr_available = False
_attr_should_poll = False
_attr_state = MediaPlayerState.IDLE
def __init__(self, plex_server, device, player_source, session=None):
"""Initialize the Plex device."""
self.plex_server = plex_server
@ -136,9 +140,6 @@ class PlexMediaPlayer(MediaPlayerEntity):
self._volume_level = 1 # since we can't retrieve remotely
self._volume_muted = False # since we can't retrieve remotely
self._attr_available = False
self._attr_should_poll = False
self._attr_state = MediaPlayerState.IDLE
self._attr_unique_id = (
f"{self.plex_server.machine_identifier}:{self.machine_identifier}"
)