Merge pull request #359 from rhooper/sonos-netdisco-fix

Prevent duplicate instances of sonos devices during netdisco
This commit is contained in:
Paulus Schoutsen
2015-09-13 13:56:10 -07:00
2 changed files with 7 additions and 1 deletions

View File

@@ -57,6 +57,7 @@ class SonosDevice(MediaPlayerDevice):
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
def __init__(self, hass, player): def __init__(self, hass, player):
self.hass = hass
super(SonosDevice, self).__init__() super(SonosDevice, self).__init__()
self._player = player self._player = player
self.update() self.update()
@@ -78,6 +79,11 @@ class SonosDevice(MediaPlayerDevice):
""" Returns the name of the device. """ """ Returns the name of the device. """
return self._name return self._name
@property
def unique_id(self):
""" Returns a unique id. """
return "{}.{}".format(self.__class__, self._player.uid)
@property @property
def state(self): def state(self):
""" Returns the state of the device. """ """ Returns the state of the device. """