mirror of
https://github.com/home-assistant/core
synced 2024-10-04 07:58:43 +02:00
Use shorthand attributes in Snapcast (#99840)
This commit is contained in:
parent
d9b48b03f7
commit
73651dbffd
@ -160,7 +160,7 @@ class SnapcastGroupDevice(MediaPlayerEntity):
|
||||
self._attr_available = True
|
||||
self._group = group
|
||||
self._entry_id = entry_id
|
||||
self._uid = f"{GROUP_PREFIX}{uid_part}_{self._group.identifier}"
|
||||
self._attr_unique_id = f"{GROUP_PREFIX}{uid_part}_{self._group.identifier}"
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Subscribe to group events."""
|
||||
@ -184,11 +184,6 @@ class SnapcastGroupDevice(MediaPlayerEntity):
|
||||
return MediaPlayerState.IDLE
|
||||
return STREAM_STATUS.get(self._group.stream_status)
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the ID of snapcast group."""
|
||||
return self._uid
|
||||
|
||||
@property
|
||||
def identifier(self):
|
||||
"""Return the snapcast identifier."""
|
||||
@ -260,7 +255,8 @@ class SnapcastClientDevice(MediaPlayerEntity):
|
||||
"""Initialize the Snapcast client device."""
|
||||
self._attr_available = True
|
||||
self._client = client
|
||||
self._uid = f"{CLIENT_PREFIX}{uid_part}_{self._client.identifier}"
|
||||
# Note: Host part is needed, when using multiple snapservers
|
||||
self._attr_unique_id = f"{CLIENT_PREFIX}{uid_part}_{self._client.identifier}"
|
||||
self._entry_id = entry_id
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
@ -278,14 +274,6 @@ class SnapcastClientDevice(MediaPlayerEntity):
|
||||
self._attr_available = available
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the ID of this snapcast client.
|
||||
|
||||
Note: Host part is needed, when using multiple snapservers
|
||||
"""
|
||||
return self._uid
|
||||
|
||||
@property
|
||||
def identifier(self):
|
||||
"""Return the snapcast identifier."""
|
||||
|
Loading…
Reference in New Issue
Block a user