Cleanup old device_tracker stuff (#8627)
* Cleanup old device_tracker stuff * Fix lint
This commit is contained in:
parent
654ad41464
commit
f86bd15580
22 changed files with 478 additions and 679 deletions
|
@ -6,8 +6,6 @@ https://home-assistant.io/components/device_tracker.snmp/
|
|||
"""
|
||||
import binascii
|
||||
import logging
|
||||
import threading
|
||||
from datetime import timedelta
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -15,7 +13,6 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.components.device_tracker import (
|
||||
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -28,8 +25,6 @@ CONF_BASEOID = 'baseoid'
|
|||
|
||||
DEFAULT_COMMUNITY = 'public'
|
||||
|
||||
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Optional(CONF_COMMUNITY, default=DEFAULT_COMMUNITY): cv.string,
|
||||
|
@ -68,9 +63,6 @@ class SnmpScanner(DeviceScanner):
|
|||
privProtocol=cfg.usmAesCfb128Protocol
|
||||
)
|
||||
self.baseoid = cmdgen.MibVariable(config[CONF_BASEOID])
|
||||
|
||||
self.lock = threading.Lock()
|
||||
|
||||
self.last_results = []
|
||||
|
||||
# Test the router is accessible
|
||||
|
@ -90,7 +82,6 @@ class SnmpScanner(DeviceScanner):
|
|||
# We have no names
|
||||
return None
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_SCANS)
|
||||
def _update_info(self):
|
||||
"""Ensure the information from the device is up to date.
|
||||
|
||||
|
@ -99,13 +90,12 @@ class SnmpScanner(DeviceScanner):
|
|||
if not self.success_init:
|
||||
return False
|
||||
|
||||
with self.lock:
|
||||
data = self.get_snmp_data()
|
||||
if not data:
|
||||
return False
|
||||
data = self.get_snmp_data()
|
||||
if not data:
|
||||
return False
|
||||
|
||||
self.last_results = data
|
||||
return True
|
||||
self.last_results = data
|
||||
return True
|
||||
|
||||
def get_snmp_data(self):
|
||||
"""Fetch MAC addresses from access point via SNMP."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue