Maintenance 2nd (#4106)
* Add link to docs * Fix link * Update line breaks * Update ordering * Align vera platofrm to only use add_devices (instead od add_devices_callback) * Remove line break * Use consts * Update ordering * Update ordering * Use const, create default name, use string formatting * Update ordering * Use const * Update import style * Update ordering and line breaks * update line breaks * Set default port * Set defaults and update ordering * Update ordering * Minor style updates * Update ordering, defaults, line breaks, and readability * Use constants * Add line breaks * use string formatting * Update line breaks * Update logger
This commit is contained in:
parent
e6ece4bf6d
commit
9f2aae1357
28 changed files with 272 additions and 271 deletions
|
@ -18,16 +18,16 @@ from homeassistant.components.device_tracker import DOMAIN, PLATFORM_SCHEMA
|
|||
from homeassistant.const import CONF_HOSTS
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
# Return cached results if last scan was less then this time ago
|
||||
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5)
|
||||
REQUIREMENTS = ['python-nmap==0.6.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONF_EXCLUDE = 'exclude'
|
||||
# Interval in minutes to exclude devices from a scan while they are home
|
||||
CONF_HOME_INTERVAL = 'home_interval'
|
||||
CONF_EXCLUDE = 'exclude'
|
||||
|
||||
REQUIREMENTS = ['python-nmap==0.6.1']
|
||||
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5)
|
||||
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_HOSTS): cv.ensure_list,
|
||||
|
@ -73,7 +73,7 @@ class NmapDeviceScanner(object):
|
|||
self.home_interval = timedelta(minutes=minutes)
|
||||
|
||||
self.success_init = self._update_info()
|
||||
_LOGGER.info('nmap scanner initialized')
|
||||
_LOGGER.info("nmap scanner initialized")
|
||||
|
||||
def scan_devices(self):
|
||||
"""Scan for new devices and return a list with found device IDs."""
|
||||
|
@ -97,7 +97,7 @@ class NmapDeviceScanner(object):
|
|||
|
||||
Returns boolean if scanning successful.
|
||||
"""
|
||||
_LOGGER.info('Scanning')
|
||||
_LOGGER.info("Scanning...")
|
||||
|
||||
from nmap import PortScanner, PortScannerError
|
||||
scanner = PortScanner()
|
||||
|
@ -138,5 +138,5 @@ class NmapDeviceScanner(object):
|
|||
|
||||
self.last_results = last_results
|
||||
|
||||
_LOGGER.info('nmap scan successful')
|
||||
_LOGGER.info("nmap scan successful")
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue