diff --git a/homeassistant/components/template/cover.py b/homeassistant/components/template/cover.py index dcfd8b41521..54ab2cf2055 100644 --- a/homeassistant/components/template/cover.py +++ b/homeassistant/components/template/cover.py @@ -1,4 +1,6 @@ """Support for covers which integrate with other components.""" +from __future__ import annotations + import logging import voluptuous as vol @@ -32,11 +34,13 @@ from homeassistant.const import ( STATE_OPEN, STATE_OPENING, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.script import Script +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .template_entity import ( @@ -123,7 +127,12 @@ async def _async_create_entities(hass, config): return covers -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the Template cover.""" async_add_entities(await _async_create_entities(hass, config)) diff --git a/homeassistant/components/template/light.py b/homeassistant/components/template/light.py index 317e1349dc9..39c44815d75 100644 --- a/homeassistant/components/template/light.py +++ b/homeassistant/components/template/light.py @@ -1,4 +1,6 @@ """Support for Template lights.""" +from __future__ import annotations + import logging import voluptuous as vol @@ -28,12 +30,14 @@ from homeassistant.const import ( STATE_OFF, STATE_ON, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.config_validation import PLATFORM_SCHEMA from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.script import Script +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .template_entity import ( @@ -115,7 +119,12 @@ async def _async_create_entities(hass, config): return lights -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the template lights.""" async_add_entities(await _async_create_entities(hass, config)) diff --git a/homeassistant/components/template/lock.py b/homeassistant/components/template/lock.py index 8f73796c37c..c5d24135fba 100644 --- a/homeassistant/components/template/lock.py +++ b/homeassistant/components/template/lock.py @@ -1,4 +1,6 @@ """Support for locks which integrates with other components.""" +from __future__ import annotations + import voluptuous as vol from homeassistant.components.lock import ( @@ -17,10 +19,12 @@ from homeassistant.const import ( STATE_ON, STATE_UNLOCKED, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.script import Script +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .template_entity import ( @@ -53,7 +57,12 @@ async def _async_create_entities(hass, config): return [TemplateLock(hass, config, config.get(CONF_UNIQUE_ID))] -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the template lock.""" async_add_entities(await _async_create_entities(hass, config)) diff --git a/homeassistant/components/template/sensor.py b/homeassistant/components/template/sensor.py index 18d0be616d4..816c71e77e7 100644 --- a/homeassistant/components/template/sensor.py +++ b/homeassistant/components/template/sensor.py @@ -35,6 +35,8 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import TemplateError from homeassistant.helpers import config_validation as cv, template from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import ( CONF_ATTRIBUTE_TEMPLATES, @@ -156,7 +158,12 @@ def _async_create_template_tracking_entities( async_add_entities(sensors) -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the template sensors.""" if discovery_info is None: _async_create_template_tracking_entities( diff --git a/homeassistant/components/template/switch.py b/homeassistant/components/template/switch.py index 9614eab0fd1..70d687d3787 100644 --- a/homeassistant/components/template/switch.py +++ b/homeassistant/components/template/switch.py @@ -1,4 +1,5 @@ """Support for switches which integrates with other components.""" +from __future__ import annotations import voluptuous as vol @@ -16,12 +17,14 @@ from homeassistant.const import ( STATE_OFF, STATE_ON, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.script import Script +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .template_entity import ( @@ -74,7 +77,12 @@ async def _async_create_entities(hass, config): return switches -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the template switches.""" async_add_entities(await _async_create_entities(hass, config)) diff --git a/homeassistant/components/template/vacuum.py b/homeassistant/components/template/vacuum.py index 02d9b0f3720..57ce3744eb2 100644 --- a/homeassistant/components/template/vacuum.py +++ b/homeassistant/components/template/vacuum.py @@ -1,4 +1,6 @@ """Support for Template vacuums.""" +from __future__ import annotations + import logging import voluptuous as vol @@ -37,11 +39,13 @@ from homeassistant.const import ( CONF_VALUE_TEMPLATE, STATE_UNKNOWN, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.script import Script +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .template_entity import ( @@ -117,7 +121,12 @@ async def _async_create_entities(hass, config): return vacuums -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the template vacuums.""" async_add_entities(await _async_create_entities(hass, config)) diff --git a/homeassistant/components/template/weather.py b/homeassistant/components/template/weather.py index 4882dc5fd99..c1133592122 100644 --- a/homeassistant/components/template/weather.py +++ b/homeassistant/components/template/weather.py @@ -1,4 +1,6 @@ """Template platform that aggregates meteorological data.""" +from __future__ import annotations + import voluptuous as vol from homeassistant.components.weather import ( @@ -21,9 +23,12 @@ from homeassistant.components.weather import ( WeatherEntity, ) from homeassistant.const import CONF_NAME, CONF_UNIQUE_ID +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv from homeassistant.helpers.config_validation import PLATFORM_SCHEMA from homeassistant.helpers.entity import async_generate_entity_id +from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .template_entity import TemplateEntity @@ -75,7 +80,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): +async def async_setup_platform( + hass: HomeAssistant, + config: ConfigType, + async_add_entities: AddEntitiesCallback, + discovery_info: DiscoveryInfoType | None = None, +) -> None: """Set up the Template weather.""" unique_id = config.get(CONF_UNIQUE_ID)