From 76b46b9175345cedf685553b954e76443a02c6bd Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg59@google.com>
Date: Sun, 2 Aug 2020 19:51:01 -0700
Subject: [PATCH] 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.
---
 homeassistant/components/lg_soundbar/media_player.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/homeassistant/components/lg_soundbar/media_player.py b/homeassistant/components/lg_soundbar/media_player.py
index 0b38bc1ab8d..448b4d3bb97 100644
--- a/homeassistant/components/lg_soundbar/media_player.py
+++ b/homeassistant/components/lg_soundbar/media_player.py
@@ -35,6 +35,8 @@ class LGDevice(MediaPlayerEntity):
         """Initialize the LG speakers."""
         self._host = discovery_info.get("host")
         self._port = discovery_info.get("port")
+        properties = discovery_info.get("properties")
+        self._uuid = properties.get("UUID")
 
         self._name = ""
         self._volume = 0
@@ -128,6 +130,11 @@ class LGDevice(MediaPlayerEntity):
             if equaliser >= len(temescal.equalisers):
                 temescal.equalisers.append("unknown " + str(equaliser))
 
+    @property
+    def unique_id(self):
+        """Return the device's unique ID."""
+        return self._uuid
+
     @property
     def name(self):
         """Return the name of the device."""
-- 
GitLab