Integrations h*: Rename HomeAssistantType to HomeAssistant. (#49590)
parent
a5a3c98aff
commit
017e32a0cb
|
@ -11,9 +11,10 @@ import voluptuous as vol
|
|||
from homeassistant.components.media_player.const import DOMAIN as MEDIA_PLAYER_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from . import services
|
||||
|
@ -36,7 +37,7 @@ MIN_UPDATE_SOURCES = timedelta(seconds=1)
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType):
|
||||
"""Set up the HEOS component."""
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
|
@ -60,7 +61,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType):
|
|||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""Initialize config entry which represents the HEOS controller."""
|
||||
# For backwards compat
|
||||
if entry.unique_id is None:
|
||||
|
@ -124,7 +125,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
|||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""Unload a config entry."""
|
||||
controller_manager = hass.data[DOMAIN][DATA_CONTROLLER_MANAGER]
|
||||
await controller_manager.disconnect()
|
||||
|
|
|
@ -30,7 +30,7 @@ from homeassistant.components.media_player.const import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import STATE_IDLE, STATE_PAUSED, STATE_PLAYING
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .const import DATA_SOURCE_MANAGER, DOMAIN as HEOS_DOMAIN, SIGNAL_HEOS_UPDATED
|
||||
|
@ -63,7 +63,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||
):
|
||||
"""Add media players for a config entry."""
|
||||
players = hass.data[HEOS_DOMAIN][DOMAIN]
|
||||
|
|
|
@ -5,8 +5,8 @@ import logging
|
|||
from pyheos import CommandFailedError, Heos, HeosError, const
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from .const import (
|
||||
ATTR_PASSWORD,
|
||||
|
@ -25,7 +25,7 @@ HEOS_SIGN_IN_SCHEMA = vol.Schema(
|
|||
HEOS_SIGN_OUT_SCHEMA = vol.Schema({})
|
||||
|
||||
|
||||
def register(hass: HomeAssistantType, controller: Heos):
|
||||
def register(hass: HomeAssistant, controller: Heos):
|
||||
"""Register HEOS services."""
|
||||
hass.services.async_register(
|
||||
DOMAIN,
|
||||
|
@ -41,7 +41,7 @@ def register(hass: HomeAssistantType, controller: Heos):
|
|||
)
|
||||
|
||||
|
||||
def remove(hass: HomeAssistantType):
|
||||
def remove(hass: HomeAssistant):
|
||||
"""Unregister HEOS services."""
|
||||
hass.services.async_remove(DOMAIN, SERVICE_SIGN_IN)
|
||||
hass.services.async_remove(DOMAIN, SERVICE_SIGN_OUT)
|
||||
|
|
|
@ -4,10 +4,11 @@ import voluptuous as vol
|
|||
from homeassistant import config_entries
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_NAME, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_registry import async_entries_for_config_entry
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
CONF_ACCESSPOINT,
|
||||
|
@ -40,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the HomematicIP Cloud component."""
|
||||
hass.data[DOMAIN] = {}
|
||||
|
||||
|
@ -66,7 +67,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up an access point from a config entry."""
|
||||
|
||||
# 0.104 introduced config entry unique id, this makes upgrading possible
|
||||
|
@ -107,7 +108,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
|||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
hap = hass.data[DOMAIN].pop(entry.unique_id)
|
||||
hap.reset_connection_listener()
|
||||
|
@ -118,7 +119,7 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> boo
|
|||
|
||||
|
||||
async def async_remove_obsolete_entities(
|
||||
hass: HomeAssistantType, entry: ConfigEntry, hap: HomematicipHAP
|
||||
hass: HomeAssistant, entry: ConfigEntry, hap: HomematicipHAP
|
||||
):
|
||||
"""Remove obsolete entities from entity registry."""
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ from homeassistant.const import (
|
|||
STATE_ALARM_DISARMED,
|
||||
STATE_ALARM_TRIGGERED,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -30,7 +29,7 @@ CONST_ALARM_CONTROL_PANEL_NAME = "HmIP Alarm Control Panel"
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP alrm control panel from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -44,7 +44,7 @@ from homeassistant.components.binary_sensor import (
|
|||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -80,7 +80,7 @@ SAM_DEVICE_ATTRIBUTES = {
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP Cloud binary sensor from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -26,7 +26,7 @@ from homeassistant.components.climate.const import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -43,7 +43,7 @@ HMIP_ECO_CM = "ECO"
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP climate from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.components.cover import (
|
|||
CoverEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -30,7 +30,7 @@ HMIP_SLATS_CLOSED = 1
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP cover from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -8,10 +8,9 @@ from homematicip.base.base_connection import HmipConnectionError
|
|||
from homematicip.base.enums import EventType
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from .const import HMIPC_AUTHTOKEN, HMIPC_HAPID, HMIPC_NAME, HMIPC_PIN, PLATFORMS
|
||||
from .errors import HmipcConnectionError
|
||||
|
@ -54,7 +53,7 @@ class HomematicipAuth:
|
|||
except HmipConnectionError:
|
||||
return False
|
||||
|
||||
async def get_auth(self, hass: HomeAssistantType, hapid, pin):
|
||||
async def get_auth(self, hass: HomeAssistant, hapid, pin):
|
||||
"""Create a HomematicIP access point object."""
|
||||
auth = AsyncAuth(hass.loop, async_get_clientsession(hass))
|
||||
try:
|
||||
|
@ -70,7 +69,7 @@ class HomematicipAuth:
|
|||
class HomematicipHAP:
|
||||
"""Manages HomematicIP HTTP and WebSocket connection."""
|
||||
|
||||
def __init__(self, hass: HomeAssistantType, config_entry: ConfigEntry) -> None:
|
||||
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize HomematicIP Cloud connection."""
|
||||
self.hass = hass
|
||||
self.config_entry = config_entry
|
||||
|
@ -234,7 +233,7 @@ class HomematicipHAP:
|
|||
)
|
||||
|
||||
async def get_hap(
|
||||
self, hass: HomeAssistantType, hapid: str, authtoken: str, name: str
|
||||
self, hass: HomeAssistant, hapid: str, authtoken: str, name: str
|
||||
) -> AsyncHome:
|
||||
"""Create a HomematicIP access point object."""
|
||||
home = AsyncHome(hass.loop, async_get_clientsession(hass))
|
||||
|
|
|
@ -26,7 +26,7 @@ from homeassistant.components.light import (
|
|||
LightEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -36,7 +36,7 @@ ATTR_CURRENT_POWER_W = "current_power_w"
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP Cloud lights from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -40,7 +40,7 @@ from homeassistant.const import (
|
|||
SPEED_KILOMETERS_PER_HOUR,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -62,7 +62,7 @@ ILLUMINATION_DEVICE_ATTRIBUTES = {
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP Cloud sensors from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -11,13 +11,14 @@ from homematicip.base.helpers import handle_config
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.config_validation import comp_entity_ids
|
||||
from homeassistant.helpers.service import (
|
||||
async_register_admin_service,
|
||||
verify_domain_control,
|
||||
)
|
||||
from homeassistant.helpers.typing import HomeAssistantType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ServiceCallType
|
||||
|
||||
from .const import DOMAIN as HMIPC_DOMAIN
|
||||
|
||||
|
@ -107,7 +108,7 @@ SCHEMA_RESET_ENERGY_COUNTER = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
async def async_setup_services(hass: HomeAssistantType) -> None:
|
||||
async def async_setup_services(hass: HomeAssistant) -> None:
|
||||
"""Set up the HomematicIP Cloud services."""
|
||||
|
||||
if hass.services.async_services().get(HMIPC_DOMAIN):
|
||||
|
@ -194,7 +195,7 @@ async def async_setup_services(hass: HomeAssistantType) -> None:
|
|||
)
|
||||
|
||||
|
||||
async def async_unload_services(hass: HomeAssistantType):
|
||||
async def async_unload_services(hass: HomeAssistant):
|
||||
"""Unload HomematicIP Cloud services."""
|
||||
if hass.data[HMIPC_DOMAIN]:
|
||||
return
|
||||
|
@ -204,7 +205,7 @@ async def async_unload_services(hass: HomeAssistantType):
|
|||
|
||||
|
||||
async def _async_activate_eco_mode_with_duration(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
"""Service to activate eco mode with duration."""
|
||||
duration = service.data[ATTR_DURATION]
|
||||
|
@ -220,7 +221,7 @@ async def _async_activate_eco_mode_with_duration(
|
|||
|
||||
|
||||
async def _async_activate_eco_mode_with_period(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
"""Service to activate eco mode with period."""
|
||||
endtime = service.data[ATTR_ENDTIME]
|
||||
|
@ -236,7 +237,7 @@ async def _async_activate_eco_mode_with_period(
|
|||
|
||||
|
||||
async def _async_activate_vacation(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
"""Service to activate vacation."""
|
||||
endtime = service.data[ATTR_ENDTIME]
|
||||
|
@ -253,7 +254,7 @@ async def _async_activate_vacation(
|
|||
|
||||
|
||||
async def _async_deactivate_eco_mode(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
"""Service to deactivate eco mode."""
|
||||
hapid = service.data.get(ATTR_ACCESSPOINT_ID)
|
||||
|
@ -268,7 +269,7 @@ async def _async_deactivate_eco_mode(
|
|||
|
||||
|
||||
async def _async_deactivate_vacation(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
"""Service to deactivate vacation."""
|
||||
hapid = service.data.get(ATTR_ACCESSPOINT_ID)
|
||||
|
@ -283,7 +284,7 @@ async def _async_deactivate_vacation(
|
|||
|
||||
|
||||
async def _set_active_climate_profile(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
hass: HomeAssistant, service: ServiceCallType
|
||||
) -> None:
|
||||
"""Service to set the active climate profile."""
|
||||
entity_id_list = service.data[ATTR_ENTITY_ID]
|
||||
|
@ -301,9 +302,7 @@ async def _set_active_climate_profile(
|
|||
await group.set_active_profile(climate_profile_index)
|
||||
|
||||
|
||||
async def _async_dump_hap_config(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
) -> None:
|
||||
async def _async_dump_hap_config(hass: HomeAssistant, service: ServiceCallType) -> None:
|
||||
"""Service to dump the configuration of a Homematic IP Access Point."""
|
||||
config_path = service.data.get(ATTR_CONFIG_OUTPUT_PATH) or hass.config.config_dir
|
||||
config_file_prefix = service.data[ATTR_CONFIG_OUTPUT_FILE_PREFIX]
|
||||
|
@ -325,9 +324,7 @@ async def _async_dump_hap_config(
|
|||
config_file.write_text(json_state, encoding="utf8")
|
||||
|
||||
|
||||
async def _async_reset_energy_counter(
|
||||
hass: HomeAssistantType, service: ServiceCallType
|
||||
):
|
||||
async def _async_reset_energy_counter(hass: HomeAssistant, service: ServiceCallType):
|
||||
"""Service to reset the energy counter."""
|
||||
entity_id_list = service.data[ATTR_ENTITY_ID]
|
||||
|
||||
|
@ -343,7 +340,7 @@ async def _async_reset_energy_counter(
|
|||
await device.reset_energy_counter()
|
||||
|
||||
|
||||
def _get_home(hass: HomeAssistantType, hapid: str) -> AsyncHome | None:
|
||||
def _get_home(hass: HomeAssistant, hapid: str) -> AsyncHome | None:
|
||||
"""Return a HmIP home."""
|
||||
hap = hass.data[HMIPC_DOMAIN].get(hapid)
|
||||
if hap:
|
||||
|
|
|
@ -22,7 +22,7 @@ from homematicip.aio.group import AsyncExtendedLinkedSwitchingGroup, AsyncSwitch
|
|||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .generic_entity import ATTR_GROUP_MEMBER_UNREACHABLE
|
||||
|
@ -30,7 +30,7 @@ from .hap import HomematicipHAP
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP switch from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -21,7 +21,7 @@ from homeassistant.components.weather import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -46,7 +46,7 @@ HOME_WEATHER_CONDITION = {
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
||||
) -> None:
|
||||
"""Set up the HomematicIP weather sensor from a config entry."""
|
||||
hap = hass.data[HMIPC_DOMAIN][config_entry.unique_id]
|
||||
|
|
|
@ -41,7 +41,7 @@ from homeassistant.const import (
|
|||
CONF_USERNAME,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import CALLBACK_TYPE, ServiceCall
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, ServiceCall
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import (
|
||||
config_validation as cv,
|
||||
|
@ -51,7 +51,7 @@ from homeassistant.helpers import (
|
|||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
ADMIN_SERVICES,
|
||||
|
@ -309,7 +309,7 @@ class HuaweiLteData:
|
|||
routers: dict[str, Router] = attr.ib(init=False, factory=dict)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
|
||||
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Set up Huawei LTE component from config entry."""
|
||||
url = config_entry.data[CONF_URL]
|
||||
|
||||
|
@ -458,9 +458,7 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry)
|
|||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry
|
||||
) -> bool:
|
||||
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Unload config entry."""
|
||||
|
||||
# Forward config entry unload to platforms
|
||||
|
@ -474,7 +472,7 @@ async def async_unload_entry(
|
|||
return True
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up Huawei LTE component."""
|
||||
|
||||
# dicttoxml (used by huawei-lte-api) has uselessly verbose INFO level.
|
||||
|
@ -556,9 +554,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
async def async_migrate_entry(
|
||||
hass: HomeAssistantType, config_entry: ConfigEntry
|
||||
) -> bool:
|
||||
async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Migrate config entry to new version."""
|
||||
if config_entry.version == 1:
|
||||
options = dict(config_entry.options)
|
||||
|
|
|
@ -13,8 +13,8 @@ from homeassistant.components.binary_sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from . import HuaweiLteBaseEntity
|
||||
from .const import (
|
||||
|
@ -28,7 +28,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: Callable[[list[Entity], bool], None],
|
||||
) -> None:
|
||||
|
|
|
@ -15,11 +15,10 @@ from homeassistant.components.device_tracker.const import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_URL
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from . import HuaweiLteBaseEntity, Router
|
||||
from .const import (
|
||||
|
@ -52,7 +51,7 @@ def _get_hosts(
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: Callable[[list[Entity], bool], None],
|
||||
) -> None:
|
||||
|
@ -129,7 +128,7 @@ def _is_us(host: _HostType) -> bool:
|
|||
|
||||
@callback
|
||||
def async_add_new_entities(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
router_url: str,
|
||||
async_add_entities: Callable[[list[Entity], bool], None],
|
||||
tracked: set[str],
|
||||
|
|
|
@ -10,7 +10,7 @@ from huawei_lte_api.exceptions import ResponseErrorException
|
|||
|
||||
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
|
||||
from homeassistant.const import CONF_RECIPIENT, CONF_URL
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import Router
|
||||
from .const import DOMAIN
|
||||
|
@ -19,7 +19,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def async_get_service(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
config: dict[str, Any],
|
||||
discovery_info: dict[str, Any] | None = None,
|
||||
) -> HuaweiLteSmsNotificationService | None:
|
||||
|
|
|
@ -23,8 +23,9 @@ from homeassistant.const import (
|
|||
STATE_UNKNOWN,
|
||||
TIME_SECONDS,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import HomeAssistantType, StateType
|
||||
from homeassistant.helpers.typing import StateType
|
||||
|
||||
from . import HuaweiLteBaseEntity
|
||||
from .const import (
|
||||
|
@ -329,7 +330,7 @@ SENSOR_META: dict[str | tuple[str, str], SensorMeta] = {
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: Callable[[list[Entity], bool], None],
|
||||
) -> None:
|
||||
|
|
|
@ -13,8 +13,8 @@ from homeassistant.components.switch import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from . import HuaweiLteBaseEntity
|
||||
from .const import DOMAIN, KEY_DIALUP_MOBILE_DATASWITCH
|
||||
|
@ -23,7 +23,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: Callable[[list[Entity], bool], None],
|
||||
) -> None:
|
||||
|
|
|
@ -20,7 +20,8 @@ from homeassistant.components.homematicip_cloud.const import (
|
|||
)
|
||||
from homeassistant.components.homematicip_cloud.hap import HomematicipHAP
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .helper import AUTH_TOKEN, HAPID, HAPPIN, HomeFactory
|
||||
|
||||
|
@ -70,7 +71,7 @@ def hmip_config_entry_fixture() -> config_entries.ConfigEntry:
|
|||
|
||||
@pytest.fixture(name="default_mock_hap_factory")
|
||||
async def default_mock_hap_factory_fixture(
|
||||
hass: HomeAssistantType, mock_connection, hmip_config_entry
|
||||
hass: HomeAssistant, mock_connection, hmip_config_entry
|
||||
) -> HomematicipHAP:
|
||||
"""Create a mocked homematic access point."""
|
||||
return HomeFactory(hass, mock_connection, hmip_config_entry)
|
||||
|
@ -98,7 +99,7 @@ def dummy_config_fixture() -> ConfigType:
|
|||
|
||||
@pytest.fixture(name="mock_hap_with_service")
|
||||
async def mock_hap_with_service_fixture(
|
||||
hass: HomeAssistantType, default_mock_hap_factory, dummy_config
|
||||
hass: HomeAssistant, default_mock_hap_factory, dummy_config
|
||||
) -> HomematicipHAP:
|
||||
"""Create a fake homematic access point with hass services."""
|
||||
mock_hap = await default_mock_hap_factory.async_get_mock_hap()
|
||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.components.homematicip_cloud.generic_entity import (
|
|||
ATTR_MODEL_TYPE,
|
||||
)
|
||||
from homeassistant.components.homematicip_cloud.hap import HomematicipHAP
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import load_fixture
|
||||
|
@ -76,7 +76,7 @@ class HomeFactory:
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
mock_connection,
|
||||
hmip_config_entry: config_entries.ConfigEntry,
|
||||
):
|
||||
|
|
Loading…
Reference in New Issue