mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use shorthand attributes for DuneHD (#99237)
This commit is contained in:
parent
750cfeb76a
commit
00ecc108d1
@ -49,10 +49,14 @@ class DuneHDPlayerEntity(MediaPlayerEntity):
|
||||
def __init__(self, player: DuneHDPlayer, name: str, unique_id: str) -> None:
|
||||
"""Initialize entity to control Dune HD."""
|
||||
self._player = player
|
||||
self._name = name
|
||||
self._media_title: str | None = None
|
||||
self._state: dict[str, Any] = {}
|
||||
self._unique_id = unique_id
|
||||
self._attr_unique_id = unique_id
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, unique_id)},
|
||||
manufacturer=ATTR_MANUFACTURER,
|
||||
name=name,
|
||||
)
|
||||
|
||||
def update(self) -> None:
|
||||
"""Update internal status of the entity."""
|
||||
@ -78,20 +82,6 @@ class DuneHDPlayerEntity(MediaPlayerEntity):
|
||||
"""Return True if entity is available."""
|
||||
return len(self._state) > 0
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return a unique_id for this entity."""
|
||||
return self._unique_id
|
||||
|
||||
@property
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, self._unique_id)},
|
||||
manufacturer=ATTR_MANUFACTURER,
|
||||
name=self._name,
|
||||
)
|
||||
|
||||
@property
|
||||
def volume_level(self) -> float:
|
||||
"""Return the volume level of the media player (0..1)."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user