mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Add entity registry support to media_player.snapcast (#14895)
Unique id for client is generated from prefix 'snapcast_client_' and MAC address Unique id for group is generated from prefix 'snapcast_group_' and UUID provided by snapcast library
This commit is contained in:
parent
bc0d0751b9
commit
20caeb5383
@ -104,6 +104,11 @@ class SnapcastGroupDevice(MediaPlayerDevice):
|
||||
'unknown': STATE_UNKNOWN,
|
||||
}.get(self._group.stream_status, STATE_UNKNOWN)
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the ID of snapcast group."""
|
||||
return '{}{}'.format(GROUP_PREFIX, self._group.identifier)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
@ -185,6 +190,11 @@ class SnapcastClientDevice(MediaPlayerDevice):
|
||||
client.set_callback(self.schedule_update_ha_state)
|
||||
self._client = client
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the ID of this snapcast client."""
|
||||
return '{}{}'.format(CLIENT_PREFIX, self._client.identifier)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user