mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Migrate Squeezebox to has entity name (#98948)
This commit is contained in:
parent
be78169065
commit
480db1f1e6
@ -35,7 +35,7 @@ from homeassistant.helpers import (
|
|||||||
entity_platform,
|
entity_platform,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
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 (
|
from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
@ -236,6 +236,8 @@ class SqueezeBoxEntity(MediaPlayerEntity):
|
|||||||
| MediaPlayerEntityFeature.GROUPING
|
| MediaPlayerEntityFeature.GROUPING
|
||||||
| MediaPlayerEntityFeature.MEDIA_ENQUEUE
|
| MediaPlayerEntityFeature.MEDIA_ENQUEUE
|
||||||
)
|
)
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, player):
|
def __init__(self, player):
|
||||||
"""Initialize the SqueezeBox device."""
|
"""Initialize the SqueezeBox device."""
|
||||||
@ -244,6 +246,10 @@ class SqueezeBoxEntity(MediaPlayerEntity):
|
|||||||
self._query_result = {}
|
self._query_result = {}
|
||||||
self._available = True
|
self._available = True
|
||||||
self._remove_dispatcher = None
|
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
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
@ -256,16 +262,6 @@ class SqueezeBoxEntity(MediaPlayerEntity):
|
|||||||
|
|
||||||
return squeezebox_attr
|
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
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
"""Return True if device connected to LMS server."""
|
"""Return True if device connected to LMS server."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user