diff --git a/homeassistant/components/knx/__init__.py b/homeassistant/components/knx/__init__.py index 87e7c0b1b14..11ed7fc3c7c 100644 --- a/homeassistant/components/knx/__init__.py +++ b/homeassistant/components/knx/__init__.py @@ -24,14 +24,14 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP, SERVICE_RELOAD, ) -from homeassistant.core import ServiceCall +from homeassistant.core import Event, HomeAssistant, ServiceCall from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import async_get_platforms from homeassistant.helpers.reload import async_integration_yaml_config from homeassistant.helpers.service import async_register_admin_service -from homeassistant.helpers.typing import ConfigType, EventType, HomeAssistantType +from homeassistant.helpers.typing import ConfigType from .const import DOMAIN, KNX_ADDRESS, SupportedPlatforms from .expose import KNXExposeSensor, KNXExposeTime, create_knx_exposure @@ -212,7 +212,7 @@ SERVICE_KNX_EXPOSURE_REGISTER_SCHEMA = vol.Any( ) -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the KNX integration.""" try: knx_module = KNXModule(hass, config) @@ -299,7 +299,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: class KNXModule: """Representation of KNX Object.""" - def __init__(self, hass: HomeAssistantType, config: ConfigType) -> None: + def __init__(self, hass: HomeAssistant, config: ConfigType) -> None: """Initialize KNX module.""" self.hass = hass self.config = config @@ -328,7 +328,7 @@ class KNXModule: self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.stop) self.connected = True - async def stop(self, event: EventType) -> None: + async def stop(self, event: Event) -> None: """Stop XKNX object. Disconnect from tunneling or Routing device.""" await self.xknx.stop() diff --git a/homeassistant/components/knx/binary_sensor.py b/homeassistant/components/knx/binary_sensor.py index df5a367098d..0faeb9f37b4 100644 --- a/homeassistant/components/knx/binary_sensor.py +++ b/homeassistant/components/knx/binary_sensor.py @@ -6,19 +6,16 @@ from typing import Any, Callable, Iterable from xknx.devices import BinarySensor as XknxBinarySensor from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import ATTR_COUNTER, DOMAIN from .knx_entity import KnxEntity async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/climate.py b/homeassistant/components/knx/climate.py index 700e080b037..ca3f7b0f22a 100644 --- a/homeassistant/components/knx/climate.py +++ b/homeassistant/components/knx/climate.py @@ -15,12 +15,9 @@ from homeassistant.components.climate.const import ( SUPPORT_TARGET_TEMPERATURE, ) from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import CONTROLLER_MODES, DOMAIN, PRESET_MODES from .knx_entity import KnxEntity @@ -30,7 +27,7 @@ PRESET_MODES_INV = {value: key for key, value in PRESET_MODES.items()} async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/cover.py b/homeassistant/components/knx/cover.py index a0f35a30636..c45d057c3af 100644 --- a/homeassistant/components/knx/cover.py +++ b/homeassistant/components/knx/cover.py @@ -21,21 +21,17 @@ from homeassistant.components.cover import ( SUPPORT_STOP_TILT, CoverEntity, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import async_track_utc_time_change -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .knx_entity import KnxEntity async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/expose.py b/homeassistant/components/knx/expose.py index f4ea52ada59..5616a6deb23 100644 --- a/homeassistant/components/knx/expose.py +++ b/homeassistant/components/knx/expose.py @@ -13,14 +13,9 @@ from homeassistant.const import ( STATE_UNAVAILABLE, STATE_UNKNOWN, ) -from homeassistant.core import callback +from homeassistant.core import Event, HomeAssistant, callback from homeassistant.helpers.event import async_track_state_change_event -from homeassistant.helpers.typing import ( - ConfigType, - EventType, - HomeAssistantType, - StateType, -) +from homeassistant.helpers.typing import ConfigType, StateType from .const import KNX_ADDRESS from .schema import ExposeSchema @@ -28,7 +23,7 @@ from .schema import ExposeSchema @callback def create_knx_exposure( - hass: HomeAssistantType, xknx: XKNX, config: ConfigType + hass: HomeAssistant, xknx: XKNX, config: ConfigType ) -> KNXExposeSensor | KNXExposeTime: """Create exposures from config.""" address = config[KNX_ADDRESS] @@ -61,7 +56,7 @@ class KNXExposeSensor: def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, xknx: XKNX, expose_type: int | str, entity_id: str, @@ -106,7 +101,7 @@ class KNXExposeSensor: self._remove_listener = None self.device.shutdown() - async def _async_entity_changed(self, event: EventType) -> None: + async def _async_entity_changed(self, event: Event) -> None: """Handle entity change.""" new_state = event.data.get("new_state") if new_state is None: diff --git a/homeassistant/components/knx/fan.py b/homeassistant/components/knx/fan.py index 7f68c2a7d51..38680e15bf8 100644 --- a/homeassistant/components/knx/fan.py +++ b/homeassistant/components/knx/fan.py @@ -7,12 +7,9 @@ from typing import Any, Callable, Iterable from xknx.devices import Fan as XknxFan from homeassistant.components.fan import SUPPORT_OSCILLATE, SUPPORT_SET_SPEED, FanEntity +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.util.percentage import ( int_states_in_range, percentage_to_ranged_value, @@ -26,7 +23,7 @@ DEFAULT_PERCENTAGE = 50 async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py index 940a9333696..0eb62433734 100644 --- a/homeassistant/components/knx/light.py +++ b/homeassistant/components/knx/light.py @@ -16,12 +16,9 @@ from homeassistant.components.light import ( SUPPORT_WHITE_VALUE, LightEntity, ) +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType import homeassistant.util.color as color_util from .const import DOMAIN @@ -34,7 +31,7 @@ DEFAULT_WHITE_VALUE = 255 async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/notify.py b/homeassistant/components/knx/notify.py index 77b89b86c4d..62ba1109526 100644 --- a/homeassistant/components/knx/notify.py +++ b/homeassistant/components/knx/notify.py @@ -6,17 +6,14 @@ from typing import Any from xknx.devices import Notification as XknxNotification from homeassistant.components.notify import BaseNotificationService -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN async def async_get_service( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, discovery_info: DiscoveryInfoType | None = None, ) -> KNXNotificationService | None: diff --git a/homeassistant/components/knx/scene.py b/homeassistant/components/knx/scene.py index bc235da4f35..ff08cdf411c 100644 --- a/homeassistant/components/knx/scene.py +++ b/homeassistant/components/knx/scene.py @@ -6,19 +6,16 @@ from typing import Any, Callable, Iterable from xknx.devices import Scene as XknxScene from homeassistant.components.scene import Scene +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .knx_entity import KnxEntity async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/sensor.py b/homeassistant/components/knx/sensor.py index 4397f8bcc0b..f14cf7e5b29 100644 --- a/homeassistant/components/knx/sensor.py +++ b/homeassistant/components/knx/sensor.py @@ -6,20 +6,16 @@ from typing import Callable, Iterable from xknx.devices import Sensor as XknxSensor from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, - StateType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, StateType from .const import DOMAIN from .knx_entity import KnxEntity async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/switch.py b/homeassistant/components/knx/switch.py index 40b028267ba..82fe2f40be3 100644 --- a/homeassistant/components/knx/switch.py +++ b/homeassistant/components/knx/switch.py @@ -6,19 +6,16 @@ from typing import Any, Callable, Iterable from xknx.devices import Switch as XknxSwitch from homeassistant.components.switch import SwitchEntity +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .knx_entity import KnxEntity async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/knx/weather.py b/homeassistant/components/knx/weather.py index c022867284e..cc2f3c0a09c 100644 --- a/homeassistant/components/knx/weather.py +++ b/homeassistant/components/knx/weather.py @@ -7,19 +7,16 @@ from xknx.devices import Weather as XknxWeather from homeassistant.components.weather import WeatherEntity from homeassistant.const import TEMP_CELSIUS +from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from .const import DOMAIN from .knx_entity import KnxEntity async def async_setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, async_add_entities: Callable[[Iterable[Entity]], None], discovery_info: DiscoveryInfoType | None = None,