mirror of
https://github.com/home-assistant/core.git
synced 2025-08-08 07:05:07 +02:00
Merge pull request #359 from rhooper/sonos-netdisco-fix
Prevent duplicate instances of sonos devices during netdisco
This commit is contained in:
@@ -57,6 +57,7 @@ class SonosDevice(MediaPlayerDevice):
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, hass, player):
|
||||
self.hass = hass
|
||||
super(SonosDevice, self).__init__()
|
||||
self._player = player
|
||||
self.update()
|
||||
@@ -78,6 +79,11 @@ class SonosDevice(MediaPlayerDevice):
|
||||
""" Returns the name of the device. """
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
""" Returns a unique id. """
|
||||
return "{}.{}".format(self.__class__, self._player.uid)
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
""" Returns the state of the device. """
|
||||
|
Reference in New Issue
Block a user