Skip to content

Commit

Permalink
Merge pull request #118 from vogon1/master
Browse files Browse the repository at this point in the history
Fix hass.helpers deprecation warning
  • Loading branch information
mudape authored Oct 12, 2024
2 parents 0803321 + 1e8932c commit 3ef9436
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions custom_components/iphonedetect/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
from homeassistant.components.device_tracker.const import (SCAN_INTERVAL,
ATTR_IP)
from homeassistant.const import CONF_HOSTS, CONF_SCAN_INTERVAL
from homeassistant.helpers.event import track_point_in_utc_time

from homeassistant.core import HomeAssistant
from homeassistant.helpers.event import track_point_in_utc_time

from .const import (
HOME_STATES,
Expand Down Expand Up @@ -81,7 +85,7 @@ def find_with_arp():
neighbours_ip = [_.split()[1][1:-1] for _ in neighbours.stdout.splitlines() if _.count(":") == 5]
return neighbours_ip

def setup_scanner(hass, config, see, discovery_info=None):
def setup_scanner(hass: HomeAssistant, config, see, discovery_info=None):
"""Set up the Host objects and return the update function."""

if subprocess.run("which ip", shell=True, stdout=subprocess.DEVNULL).returncode == 0:
Expand Down Expand Up @@ -121,8 +125,8 @@ def update_interval(now):
_LOGGER.error(e)

finally:
hass.helpers.event.track_point_in_utc_time(
update_interval, dt_util.utcnow() + interval)
track_point_in_utc_time(
hass, update_interval, dt_util.utcnow() + interval)

update_interval(None)
return True

0 comments on commit 3ef9436

Please sign in to comment.