UTC upgrades for scheduler, nmap tracker, dsl_trigger
This commit is contained in:
parent
cd2b9ce975
commit
ae0cf49560
4 changed files with 14 additions and 13 deletions
|
@ -21,7 +21,7 @@ The IP addresses to scan in the network-prefix notation (192.168.1.1/24) or
|
|||
the range notation (192.168.1.1-255).
|
||||
"""
|
||||
import logging
|
||||
from datetime import timedelta, datetime
|
||||
from datetime import timedelta
|
||||
from collections import namedtuple
|
||||
import subprocess
|
||||
import re
|
||||
|
@ -29,6 +29,7 @@ import re
|
|||
from libnmap.process import NmapProcess
|
||||
from libnmap.parser import NmapParser, NmapParserException
|
||||
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.const import CONF_HOSTS
|
||||
from homeassistant.helpers import validate_config
|
||||
from homeassistant.util import Throttle, convert
|
||||
|
@ -106,7 +107,7 @@ class NmapDeviceScanner(object):
|
|||
Returns True if successful, False otherwise. """
|
||||
try:
|
||||
results = NmapParser.parse(stdout)
|
||||
now = datetime.now()
|
||||
now = dt_util.now()
|
||||
self.last_results = []
|
||||
for host in results.hosts:
|
||||
if host.is_up():
|
||||
|
@ -140,7 +141,7 @@ class NmapDeviceScanner(object):
|
|||
options = "-F --host-timeout 5"
|
||||
exclude_targets = set()
|
||||
if self.home_interval:
|
||||
now = datetime.now()
|
||||
now = dt_util.now()
|
||||
for host in self.last_results:
|
||||
if host.last_update + self.home_interval > now:
|
||||
exclude_targets.add(host)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue