mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
TomatoDeviceScanner init optimization
This commit is contained in:
parent
117b8454c3
commit
2d81cc65f7
@ -17,8 +17,6 @@ class TomatoDeviceScanner(object):
|
||||
self.config = config
|
||||
self.logger = logging.getLogger(__name__)
|
||||
self.lock = Lock()
|
||||
self.date_updated = None
|
||||
self.last_results = None
|
||||
|
||||
# Read known devices
|
||||
if os.path.isfile(KNOWN_DEVICES_FILE):
|
||||
@ -36,6 +34,9 @@ class TomatoDeviceScanner(object):
|
||||
if mac not in known_devices:
|
||||
writer.writerow((mac, name, 0))
|
||||
|
||||
self.last_results = [mac for iface, mac, rssi, tx, rx, quality, unknown_num in wldev]
|
||||
self.date_updated = datetime.now()
|
||||
|
||||
# Create a dict with ID: NAME of the devices to track
|
||||
self.devices_to_track = dict()
|
||||
|
||||
@ -67,6 +68,7 @@ class TomatoDeviceScanner(object):
|
||||
exec(self._tomato_request("devlist"))
|
||||
|
||||
self.last_results = [mac for iface, mac, rssi, tx, rx, quality, unknown_num in wldev]
|
||||
self.date_updated = datetime.now()
|
||||
|
||||
except Exception as e:
|
||||
self.logger.exception("Scanning failed")
|
||||
|
Loading…
x
Reference in New Issue
Block a user