From 63ff173305f98d09d20823fd86137fa0efb9676a Mon Sep 17 00:00:00 2001 From: Andy Castille Date: Fri, 7 Jul 2017 01:07:12 -0500 Subject: [PATCH] Use user-set device names for Linksys Smart Wi-Fi routers (3) (#8300) * Use user-set device names for Linksys Smart Wi-Fi routers (3) * Newline at end of linksys_smart.py * Remove spaces in last line of linksys_smart.py * Update linksys_smart.py --- homeassistant/components/device_tracker/linksys_smart.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/device_tracker/linksys_smart.py b/homeassistant/components/device_tracker/linksys_smart.py index 2d7fbfea33c..e71502ba5ee 100644 --- a/homeassistant/components/device_tracker/linksys_smart.py +++ b/homeassistant/components/device_tracker/linksys_smart.py @@ -83,11 +83,14 @@ class LinksysSmartWifiDeviceScanner(DeviceScanner): if not connections: _LOGGER.debug("Device %s is not connected", mac) continue - name = device["friendlyName"] - properties = device["properties"] - for prop in properties: + + name = None + for prop in device["properties"]: if prop["name"] == "userDeviceName": name = prop["value"] + if not name: + name = device.get("friendlyName", device["deviceID"]) + _LOGGER.debug("Device %s is connected", mac) self.last_results[mac] = name except (KeyError, IndexError):