|
8 | 8 | from aiohttp import ClientSession |
9 | 9 | from aiovodafone import VodafoneStationDevice, VodafoneStationSercommApi, exceptions |
10 | 10 |
|
11 | | -from homeassistant.components.device_tracker import DEFAULT_CONSIDER_HOME |
| 11 | +from homeassistant.components.device_tracker import ( |
| 12 | + DEFAULT_CONSIDER_HOME, |
| 13 | + DOMAIN as DEVICE_TRACKER_DOMAIN, |
| 14 | +) |
12 | 15 | from homeassistant.config_entries import ConfigEntry |
13 | 16 | from homeassistant.core import HomeAssistant |
14 | 17 | from homeassistant.exceptions import ConfigEntryAuthFailed |
15 | | -from homeassistant.helpers import device_registry as dr |
| 18 | +from homeassistant.helpers import entity_registry as er |
16 | 19 | from homeassistant.helpers.device_registry import DeviceInfo |
17 | 20 | from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed |
18 | 21 | from homeassistant.util import dt as dt_util |
@@ -71,16 +74,14 @@ def __init__( |
71 | 74 | update_interval=timedelta(seconds=SCAN_INTERVAL), |
72 | 75 | config_entry=config_entry, |
73 | 76 | ) |
74 | | - device_reg = dr.async_get(self.hass) |
75 | | - device_list = dr.async_entries_for_config_entry( |
76 | | - device_reg, self.config_entry.entry_id |
77 | | - ) |
78 | 77 |
|
| 78 | + entity_reg = er.async_get(hass) |
79 | 79 | self.previous_devices = { |
80 | | - connection[1].upper() |
81 | | - for device in device_list |
82 | | - for connection in device.connections |
83 | | - if connection[0] == dr.CONNECTION_NETWORK_MAC |
| 80 | + entry.unique_id |
| 81 | + for entry in er.async_entries_for_config_entry( |
| 82 | + entity_reg, config_entry.entry_id |
| 83 | + ) |
| 84 | + if entry.domain == DEVICE_TRACKER_DOMAIN |
84 | 85 | } |
85 | 86 |
|
86 | 87 | def _calculate_update_time_and_consider_home( |
|
0 commit comments