mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +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:
|
def __init__(self, player: DuneHDPlayer, name: str, unique_id: str) -> None:
|
||||||
"""Initialize entity to control Dune HD."""
|
"""Initialize entity to control Dune HD."""
|
||||||
self._player = player
|
self._player = player
|
||||||
self._name = name
|
|
||||||
self._media_title: str | None = None
|
self._media_title: str | None = None
|
||||||
self._state: dict[str, Any] = {}
|
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:
|
def update(self) -> None:
|
||||||
"""Update internal status of the entity."""
|
"""Update internal status of the entity."""
|
||||||
@ -78,20 +82,6 @@ class DuneHDPlayerEntity(MediaPlayerEntity):
|
|||||||
"""Return True if entity is available."""
|
"""Return True if entity is available."""
|
||||||
return len(self._state) > 0
|
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
|
@property
|
||||||
def volume_level(self) -> float:
|
def volume_level(self) -> float:
|
||||||
"""Return the volume level of the media player (0..1)."""
|
"""Return the volume level of the media player (0..1)."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user