Cleanup old device_tracker stuff (#8627)

* Cleanup old device_tracker stuff

* Fix lint
This commit is contained in:
Pascal Vizeli authored and Paulus Schoutsen committed 2017-07-24 07:45:02 -07:00
1 parent 654ad41464
commit f86bd15580
22 files changed
+478 -679

No files matched your search

@@ -7,9 +7,7 @@ https://home-assistant.io/components/device_tracker.actiontec/
import logging
import re
import telnetlib
import threading
from collections import namedtuple
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
@@ -17,9 +15,6 @@ import homeassistant.util.dt as dt_util
from homeassistant.components.device_tracker import (
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.util import Throttle
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5)
_LOGGER = logging.getLogger(__name__)
@@ -54,7 +49,6 @@ class ActiontecDeviceScanner(DeviceScanner):
self.host = config[CONF_HOST]
self.username = config[CONF_USERNAME]
self.password = config[CONF_PASSWORD]
self.lock = threading.Lock()
self.last_results = []
data = self.get_actiontec_data()
self.success_init = data is not None
@@ -74,7 +68,6 @@ class ActiontecDeviceScanner(DeviceScanner):
return client.ip
return None
@Throttle(MIN_TIME_BETWEEN_SCANS)
def _update_info(self):
"""Ensure the information from the router is up to date.
@@ -84,16 +77,15 @@ class ActiontecDeviceScanner(DeviceScanner):
if not self.success_init:
return False
with self.lock:
now = dt_util.now()
actiontec_data = self.get_actiontec_data()
if not actiontec_data:
return False
self.last_results = [Device(data['mac'], name, now)
for name, data in actiontec_data.items()
if data['timevalid'] > -60]
_LOGGER.info("Scan successful")
return True
now = dt_util.now()
actiontec_data = self.get_actiontec_data()
if not actiontec_data:
return False
self.last_results = [Device(data['mac'], name, now)
for name, data in actiontec_data.items()
if data['timevalid'] > -60]
_LOGGER.info("Scan successful")
return True
def get_actiontec_data(self):
"""Retrieve data from Actiontec MI424WR and return parsed result."""