Repository: gurumitts/pylutron-caseta

Issue:
Device name uses incomplete name.
https://github.com/gurumitts/pylutron-caseta/blob/52dfa7000b7cd23bee586671d8ef839c932178b8/pylutron_caseta/smartbridge.py#L321

Device name is assigned the `Name` value from the devices dict, however, the `FullyQualifiedName` would be more appropriate as the latest Lutron Caseta app enforces the use of Rooms. The room name is the prefix the `FullyQualifiedName` and left out of `Name`. This leads to multiple switches/dimmers named `Light` or `Lights` vs `Kitchen Lights`, `Kitchen Table Lights`.

Changing line 321 to `device_name = " ".join(device["FullyQualifiedName"])` seems more appropriate.

Discussion:

Patch:
diff --git a/pylutron_caseta/smartbridge.py b/pylutron_caseta/smartbridge.py
index 05527d7..fd50d34 100755
--- a/pylutron_caseta/smartbridge.py
+++ b/pylutron_caseta/smartbridge.py
@@ -318,7 +318,7 @@ class Smartbridge:
             if 'LocalZones' in device:
                 device_zone = device['LocalZones'][0]['href']
                 device_zone = device_zone[device_zone.rfind('/') + 1:]
-            device_name = device['Name']
+            device_name = '_'.join(device['FullyQualifiedName'])
             device_type = device['DeviceType']
             self.devices[device_id] = {'device_id': device_id,
                                        'name': device_name,


Test patch:
diff --git a/tests/test_smartbridge.py b/tests/test_smartbridge.py
index 16adacf..874e593 100644
--- a/tests/test_smartbridge.py
+++ b/tests/test_smartbridge.py
@@ -188,7 +188,7 @@ def test_device_list(event_loop, bridge):
             "current_state": -1},
         "2": {
             "device_id": "2",
-            "name": "Lights",
+            "name": "Hallway_Lights",
             "type": "WallDimmer",
             "zone": "1",
             "current_state": -1}}