Set roku media player device class in constructor (#100225)
This commit is contained in:
parent
42c35da818
commit
9c775a8a24
1 changed files with 8 additions and 8 deletions
|
@ -122,6 +122,14 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
|||
| MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||
)
|
||||
|
||||
def __init__(self, coordinator: RokuDataUpdateCoordinator) -> None:
|
||||
"""Initialize the Roku device."""
|
||||
super().__init__(coordinator=coordinator)
|
||||
if coordinator.data.info.device_type == "tv":
|
||||
self._attr_device_class = MediaPlayerDeviceClass.TV
|
||||
else:
|
||||
self._attr_device_class = MediaPlayerDeviceClass.RECEIVER
|
||||
|
||||
def _media_playback_trackable(self) -> bool:
|
||||
"""Detect if we have enough media data to track playback."""
|
||||
if self.coordinator.data.media is None or self.coordinator.data.media.live:
|
||||
|
@ -129,14 +137,6 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
|||
|
||||
return self.coordinator.data.media.duration > 0
|
||||
|
||||
@property
|
||||
def device_class(self) -> MediaPlayerDeviceClass:
|
||||
"""Return the class of this device."""
|
||||
if self.coordinator.data.info.device_type == "tv":
|
||||
return MediaPlayerDeviceClass.TV
|
||||
|
||||
return MediaPlayerDeviceClass.RECEIVER
|
||||
|
||||
@property
|
||||
def state(self) -> MediaPlayerState | None:
|
||||
"""Return the state of the device."""
|
||||
|
|
Loading…
Add table
Reference in a new issue