Fix duplicate lg_soundbar entities and disable polling (#42044)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Berni Moses 2021-02-03 17:06:02 +01:00 committed by GitHub
parent 6458ff774f
commit a584ad5ac3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,12 +29,11 @@ class LGDevice(MediaPlayerEntity):
def __init__(self, discovery_info): def __init__(self, discovery_info):
"""Initialize the LG speakers.""" """Initialize the LG speakers."""
self._host = discovery_info.get("host") self._host = discovery_info["host"]
self._port = discovery_info.get("port") self._port = discovery_info["port"]
properties = discovery_info.get("properties") self._hostname = discovery_info["hostname"]
self._uuid = properties.get("UUID")
self._name = "" self._name = self._hostname.split(".")[0]
self._volume = 0 self._volume = 0
self._volume_min = 0 self._volume_min = 0
self._volume_max = 0 self._volume_max = 0
@ -122,9 +121,9 @@ class LGDevice(MediaPlayerEntity):
self._device.get_product_info() self._device.get_product_info()
@property @property
def unique_id(self): def should_poll(self):
"""Return the device's unique ID.""" """No polling needed."""
return self._uuid return False
@property @property
def name(self): def name(self):