Migrate Squeezebox to has entity name (#98948)
This commit is contained in:
parent
be78169065
commit
480db1f1e6
1 changed files with 7 additions and 11 deletions
|
@ -35,7 +35,7 @@ from homeassistant.helpers import (
|
|||
entity_platform,
|
||||
)
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.device_registry import format_mac
|
||||
from homeassistant.helpers.device_registry import DeviceInfo, format_mac
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
|
@ -236,6 +236,8 @@ class SqueezeBoxEntity(MediaPlayerEntity):
|
|||
| MediaPlayerEntityFeature.GROUPING
|
||||
| MediaPlayerEntityFeature.MEDIA_ENQUEUE
|
||||
)
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, player):
|
||||
"""Initialize the SqueezeBox device."""
|
||||
|
@ -244,6 +246,10 @@ class SqueezeBoxEntity(MediaPlayerEntity):
|
|||
self._query_result = {}
|
||||
self._available = True
|
||||
self._remove_dispatcher = None
|
||||
self._attr_unique_id = format_mac(self._player.player_id)
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self._attr_unique_id)}, name=self._player.name
|
||||
)
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
|
@ -256,16 +262,6 @@ class SqueezeBoxEntity(MediaPlayerEntity):
|
|||
|
||||
return squeezebox_attr
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
return self._player.name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique ID."""
|
||||
return format_mac(self._player.player_id)
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Return True if device connected to LMS server."""
|
||||
|
|
Loading…
Add table
Reference in a new issue