Add setup type hints to iperf3

pull/63782/head
epenet 2022-01-12 09:27:01 +00:00
parent 43807f02c3
commit 9a382e4ba3
1 changed files with 14 additions and 2 deletions

View File

@ -1,9 +1,13 @@
"""Support for Iperf3 sensors."""
from __future__ import annotations
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import ATTR_VERSION, DATA_UPDATED, DOMAIN as IPERF3_DOMAIN, SENSOR_TYPES
@ -16,8 +20,16 @@ ATTR_REMOTE_HOST = "Remote Server"
ATTR_REMOTE_PORT = "Remote Port"
async def async_setup_platform(hass, config, async_add_entities, discovery_info):
async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the Iperf3 sensor."""
if not discovery_info:
return
entities = [
Iperf3Sensor(iperf3_host, description)
for iperf3_host in hass.data[IPERF3_DOMAIN].values()