Improve proximity typing (#65053)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Marc Mueller 2022-01-27 17:05:08 +01:00 committed by GitHub
parent c3967dec10
commit 3a45168b97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,14 +70,14 @@ def setup_proximity_component(
hass: HomeAssistant, name: str, config: ConfigType hass: HomeAssistant, name: str, config: ConfigType
) -> bool: ) -> bool:
"""Set up the individual proximity component.""" """Set up the individual proximity component."""
ignored_zones = config.get(CONF_IGNORED_ZONES) ignored_zones: list[str] = config[CONF_IGNORED_ZONES]
proximity_devices = config.get(CONF_DEVICES) proximity_devices: list[str] = config[CONF_DEVICES]
tolerance = config.get(CONF_TOLERANCE) tolerance: int = config[CONF_TOLERANCE]
proximity_zone = name proximity_zone = name
unit_of_measurement = config.get( unit_of_measurement: str = config.get(
CONF_UNIT_OF_MEASUREMENT, hass.config.units.length_unit CONF_UNIT_OF_MEASUREMENT, hass.config.units.length_unit
) )
zone_id = f"zone.{config.get(CONF_ZONE)}" zone_id = f"zone.{config[CONF_ZONE]}"
proximity = Proximity( # type:ignore[no-untyped-call] proximity = Proximity( # type:ignore[no-untyped-call]
hass, hass,