Provide a unique entity ID for lgsoundbar (#38494)
The device gives us a UUID, so let's just use that to construct a unique ID.
This commit is contained in:
parent
542c6cce25
commit
76b46b9175
1 changed files with 7 additions and 0 deletions
|
@ -35,6 +35,8 @@ class LGDevice(MediaPlayerEntity):
|
||||||
"""Initialize the LG speakers."""
|
"""Initialize the LG speakers."""
|
||||||
self._host = discovery_info.get("host")
|
self._host = discovery_info.get("host")
|
||||||
self._port = discovery_info.get("port")
|
self._port = discovery_info.get("port")
|
||||||
|
properties = discovery_info.get("properties")
|
||||||
|
self._uuid = properties.get("UUID")
|
||||||
|
|
||||||
self._name = ""
|
self._name = ""
|
||||||
self._volume = 0
|
self._volume = 0
|
||||||
|
@ -128,6 +130,11 @@ class LGDevice(MediaPlayerEntity):
|
||||||
if equaliser >= len(temescal.equalisers):
|
if equaliser >= len(temescal.equalisers):
|
||||||
temescal.equalisers.append("unknown " + str(equaliser))
|
temescal.equalisers.append("unknown " + str(equaliser))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return the device's unique ID."""
|
||||||
|
return self._uuid
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Return the name of the device."""
|
"""Return the name of the device."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue