nmap_tracker: don't scan on setup (#12322)

* nmap_tracker: don't scan on setup

	A scan takes about 6 seconds so it delays HA from booting. Since
another scan is done by the device_tracker base component during setup,
there is no need to do two scans on boot.

* simplify setup
pull/12343/head
Abílio Costa 2018-02-12 07:52:00 +00:00 committed by Daniel Høyer Iversen
parent 04b68902e3
commit d34a4fb6e3
1 changed files with 1 additions and 4 deletions

View File

@ -41,9 +41,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def get_scanner(hass, config):
"""Validate the configuration and return a Nmap scanner."""
scanner = NmapDeviceScanner(config[DOMAIN])
return scanner if scanner.success_init else None
return NmapDeviceScanner(config[DOMAIN])
Device = namedtuple('Device', ['mac', 'name', 'ip', 'last_update'])
@ -76,7 +74,6 @@ class NmapDeviceScanner(DeviceScanner):
self._options = config[CONF_OPTIONS]
self.home_interval = timedelta(minutes=minutes)
self.success_init = self._update_info()
_LOGGER.info("Scanner initialized")
def scan_devices(self):