Skip to content

Commit

Permalink
Fix snapcast uuid to be more unique
Browse files Browse the repository at this point in the history
Current uuid is ok when using only 1 snapserver
New uuid is needed when using multiple snapserver

Because the client can connect to more snapservers and
then uuid based on client MAC is not enough
  • Loading branch information
jedi7 committed Jun 11, 2018
1 parent 1c561ea commit e15b4c1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions homeassistant/components/media_player/snapcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ def state(self):
@property
def unique_id(self):
"""Return the ID of snapcast group."""
return '{}{}'.format(GROUP_PREFIX, self._group.identifier)
return '{}{}_{}'.format(GROUP_PREFIX, self._group._server._host,
self._group.identifier)

@property
def name(self):
"""Return the name of the device."""
return '{}{}'.format(GROUP_PREFIX, self._group.identifier)
return '{}{}_{}'.format(GROUP_PREFIX, self._group._server._host,
self._group.identifier)

@property
def source(self):
Expand Down Expand Up @@ -192,13 +194,19 @@ def __init__(self, client):

@property
def unique_id(self):
"""Return the ID of this snapcast client."""
return '{}{}'.format(CLIENT_PREFIX, self._client.identifier)
"""
Return the ID of this snapcast client.
Note: Host part is needed, when using multiple snapservers
"""
return '{}{}_{}'.format(CLIENT_PREFIX, self._client._server._host,
self._client.identifier)

@property
def name(self):
"""Return the name of the device."""
return '{}{}'.format(CLIENT_PREFIX, self._client.identifier)
return '{}{}_{}'.format(CLIENT_PREFIX, self._client._server._host,
self._client.identifier)

@property
def volume_level(self):
Expand Down

0 comments on commit e15b4c1

Please sign in to comment.