Fix PEP257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-07 21:18:53 +01:00
1 parent f6bc1a4575
commit cc7a4d545e
17 files changed
+156 -246

No files matched your search

@@ -49,11 +49,14 @@ def get_scanner(hass, config):
class UnifiScanner(object):
"""Provide device_tracker support from Unifi WAP client data."""
def __init__(self, controller):
"""Initialize the scanner."""
self._controller = controller
self._update()
def _update(self):
"""Get the clients from the device."""
try:
clients = self._controller.get_clients()
except urllib.error.HTTPError as ex:
@@ -63,12 +66,12 @@ class UnifiScanner(object):
self._clients = {client['mac']: client for client in clients}
def scan_devices(self):
"""Scans for devices."""
"""Scan for devices."""
self._update()
return self._clients.keys()
def get_device_name(self, mac):
"""Returns the name (if known) of the device.
"""Return the name (if known) of the device.
If a name has been set in Unifi, then return that, else
return the hostname if it has been detected.