diff --git a/homeassistant/components/iperf3/sensor.py b/homeassistant/components/iperf3/sensor.py index 4e102b69782..b06c3584c56 100644 --- a/homeassistant/components/iperf3/sensor.py +++ b/homeassistant/components/iperf3/sensor.py @@ -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()