Add setup type hints to proximity (#63990)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/64020/head
parent
1cf2f0b944
commit
4fad49ec57
|
@ -15,9 +15,11 @@ from homeassistant.const import (
|
|||
LENGTH_MILES,
|
||||
LENGTH_YARD,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import track_state_change
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util.distance import convert
|
||||
from homeassistant.util.location import distance
|
||||
|
||||
|
@ -64,7 +66,9 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup_proximity_component(hass, name, config):
|
||||
def setup_proximity_component(
|
||||
hass: HomeAssistant, name: str, config: ConfigType
|
||||
) -> bool:
|
||||
"""Set up the individual proximity component."""
|
||||
ignored_zones = config.get(CONF_IGNORED_ZONES)
|
||||
proximity_devices = config.get(CONF_DEVICES)
|
||||
|
@ -75,7 +79,7 @@ def setup_proximity_component(hass, name, config):
|
|||
)
|
||||
zone_id = f"zone.{config.get(CONF_ZONE)}"
|
||||
|
||||
proximity = Proximity(
|
||||
proximity = Proximity( # type:ignore[no-untyped-call]
|
||||
hass,
|
||||
proximity_zone,
|
||||
DEFAULT_DIST_TO_ZONE,
|
||||
|
@ -96,7 +100,7 @@ def setup_proximity_component(hass, name, config):
|
|||
return True
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Get the zones and offsets from configuration.yaml."""
|
||||
for zone, proximity_config in config[DOMAIN].items():
|
||||
setup_proximity_component(hass, zone, proximity_config)
|
||||
|
|
Loading…
Reference in New Issue