Use dataclass to carry data in ping (#99803)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
b881057aa6
commit
3c455391c2
6 changed files with 28 additions and 11 deletions
|
@ -25,7 +25,8 @@ from homeassistant.util import dt as dt_util
|
|||
from homeassistant.util.async_ import gather_with_limited_concurrency
|
||||
from homeassistant.util.process import kill_subprocess
|
||||
|
||||
from .const import DOMAIN, ICMP_TIMEOUT, PING_ATTEMPTS_COUNT, PING_PRIVS, PING_TIMEOUT
|
||||
from . import PingDomainData
|
||||
from .const import DOMAIN, ICMP_TIMEOUT, PING_ATTEMPTS_COUNT, PING_TIMEOUT
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -97,7 +98,9 @@ async def async_setup_scanner(
|
|||
) -> bool:
|
||||
"""Set up the Host objects and return the update function."""
|
||||
|
||||
privileged = hass.data[DOMAIN][PING_PRIVS]
|
||||
data: PingDomainData = hass.data[DOMAIN]
|
||||
|
||||
privileged = data.privileged
|
||||
ip_to_dev_id = {ip: dev_id for (dev_id, ip) in config[CONF_HOSTS].items()}
|
||||
interval = config.get(
|
||||
CONF_SCAN_INTERVAL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue