Rename HomeAssistantType —> HomeAssistant for integrations n* - p* (#49559)

This commit is contained in:
jan iversen 2021-04-22 20:23:19 +02:00 committed by GitHub
parent c351098f04
commit 34b258e812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 74 additions and 77 deletions

View File

@ -1,14 +1,14 @@
"""Support for Nest binary sensors that dispatches between API versions."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from .const import DATA_SDM
from .legacy.binary_sensor import async_setup_legacy_entry
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the binary sensors."""
assert DATA_SDM not in entry.data

View File

@ -1,7 +1,7 @@
"""Support for Nest cameras that dispatches between API versions."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from .camera_sdm import async_setup_sdm_entry
from .const import DATA_SDM
@ -9,7 +9,7 @@ from .legacy.camera import async_setup_legacy_entry
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the cameras."""
if DATA_SDM not in entry.data:

View File

@ -16,9 +16,9 @@ from haffmpeg.tools import IMAGE_JPEG
from homeassistant.components.camera import SUPPORT_STREAM, Camera
from homeassistant.components.ffmpeg import async_get_image
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.event import async_track_point_in_utc_time
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.util.dt import utcnow
from .const import DATA_SUBSCRIBER, DOMAIN
@ -31,7 +31,7 @@ STREAM_EXPIRATION_BUFFER = datetime.timedelta(seconds=30)
async def async_setup_sdm_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the cameras."""

View File

@ -1,7 +1,7 @@
"""Support for Nest climate that dispatches between API versions."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from .climate_sdm import async_setup_sdm_entry
from .const import DATA_SDM
@ -9,7 +9,7 @@ from .legacy.climate import async_setup_legacy_entry
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the climate platform."""
if DATA_SDM not in entry.data:

View File

@ -35,8 +35,8 @@ from homeassistant.components.climate.const import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.typing import HomeAssistantType
from .const import DATA_SUBSCRIBER, DOMAIN
from .device_info import DeviceInfo
@ -78,7 +78,7 @@ MAX_FAN_DURATION = 43200 # 15 hours is the max in the SDM API
async def async_setup_sdm_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the client entities."""

View File

@ -1,7 +1,7 @@
"""Support for Nest sensors that dispatches between API versions."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from .const import DATA_SDM
from .legacy.sensor import async_setup_legacy_entry
@ -9,7 +9,7 @@ from .sensor_sdm import async_setup_sdm_entry
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the sensors."""
if DATA_SDM not in entry.data:

View File

@ -15,8 +15,8 @@ from homeassistant.const import (
PERCENTAGE,
TEMP_CELSIUS,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.typing import HomeAssistantType
from .const import DATA_SUBSCRIBER, DOMAIN
from .device_info import DeviceInfo
@ -33,7 +33,7 @@ DEVICE_TYPE_MAP = {
async def async_setup_sdm_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the sensors."""

View File

@ -19,14 +19,14 @@ from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP,
LENGTH_KILOMETERS,
)
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import aiohttp_client, config_validation as cv
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
async_dispatcher_send,
)
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__)
@ -66,7 +66,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
async def async_setup_platform(
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
):
"""Set up the NSW Rural Fire Service Feed platform."""
scan_interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL)

View File

@ -9,13 +9,14 @@ from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.config_validation import ( # noqa: F401
PLATFORM_SCHEMA,
PLATFORM_SCHEMA_BASE,
)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import ConfigType
from .const import (
ATTR_MAX,
@ -38,7 +39,7 @@ MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
_LOGGER = logging.getLogger(__name__)
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up Number entities."""
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
@ -54,12 +55,12 @@ 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 a config entry."""
return await hass.data[DOMAIN].async_setup_entry(entry) # type: ignore
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.data[DOMAIN].async_unload_entry(entry) # type: ignore

View File

@ -7,8 +7,7 @@ import logging
from typing import Any
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import Context, State
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import Context, HomeAssistant, State
from . import ATTR_VALUE, DOMAIN, SERVICE_SET_VALUE
@ -16,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
async def _async_reproduce_state(
hass: HomeAssistantType,
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
@ -50,7 +49,7 @@ async def _async_reproduce_state(
async def async_reproduce_states(
hass: HomeAssistantType,
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,

View File

@ -22,8 +22,8 @@ from homeassistant.const import (
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
from homeassistant.core import callback
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.typing import ConfigType
from homeassistant.util.distance import convert as convert_distance
from homeassistant.util.dt import utcnow
from homeassistant.util.pressure import convert as convert_pressure
@ -78,7 +78,7 @@ def convert_condition(time, weather):
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigType, async_add_entities
hass: HomeAssistant, entry: ConfigType, async_add_entities
) -> None:
"""Set up the NWS weather platform."""
hass_data = hass.data[DOMAIN][entry.entry_id]

View File

@ -13,8 +13,8 @@ from homeassistant.const import (
CONF_SSL,
CONF_USERNAME,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import (
@ -59,7 +59,7 @@ SPEED_LIMIT_SCHEMA = vol.Schema(
)
async def async_setup(hass: HomeAssistantType, config: dict) -> bool:
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
"""Set up the NZBGet integration."""
hass.data.setdefault(DOMAIN, {})
@ -78,7 +78,7 @@ async def async_setup(hass: HomeAssistantType, config: dict) -> 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 NZBGet from a config entry."""
if not entry.options:
options = {
@ -113,7 +113,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."""
unload_ok = all(
await asyncio.gather(
@ -132,7 +132,7 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> boo
def _async_register_services(
hass: HomeAssistantType,
hass: HomeAssistant,
coordinator: NZBGetDataUpdateCoordinator,
) -> None:
"""Register integration-level services."""
@ -156,7 +156,7 @@ def _async_register_services(
)
async def _async_update_listener(hass: HomeAssistantType, entry: ConfigEntry) -> None:
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id)

View File

@ -17,8 +17,8 @@ from homeassistant.const import (
CONF_USERNAME,
CONF_VERIFY_SSL,
)
from homeassistant.core import callback
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.typing import ConfigType
from .const import (
DEFAULT_NAME,
@ -33,7 +33,7 @@ from .coordinator import NZBGetAPI, NZBGetAPIException
_LOGGER = logging.getLogger(__name__)
def validate_input(hass: HomeAssistantType, data: dict) -> dict[str, Any]:
def validate_input(hass: HomeAssistant, data: dict) -> dict[str, Any]:
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.

View File

@ -14,7 +14,7 @@ from homeassistant.const import (
CONF_USERNAME,
CONF_VERIFY_SSL,
)
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import DOMAIN
@ -25,7 +25,7 @@ _LOGGER = logging.getLogger(__name__)
class NZBGetDataUpdateCoordinator(DataUpdateCoordinator):
"""Class to manage fetching NZBGet data."""
def __init__(self, hass: HomeAssistantType, *, config: dict, options: dict):
def __init__(self, hass: HomeAssistant, *, config: dict, options: dict):
"""Initialize global NZBGet data updater."""
self.nzbget = NZBGetAPI(
config[CONF_HOST],

View File

@ -13,8 +13,8 @@ from homeassistant.const import (
DATA_RATE_MEGABYTES_PER_SECOND,
DEVICE_CLASS_TIMESTAMP,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.util.dt import utcnow
from . import NZBGetEntity
@ -42,7 +42,7 @@ SENSOR_TYPES = {
async def async_setup_entry(
hass: HomeAssistantType,
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: Callable[[list[Entity], bool], None],
) -> None:

View File

@ -6,8 +6,8 @@ from typing import Callable
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import HomeAssistantType
from . import NZBGetEntity
from .const import DATA_COORDINATOR, DOMAIN
@ -15,7 +15,7 @@ from .coordinator import NZBGetDataUpdateCoordinator
async def async_setup_entry(
hass: HomeAssistantType,
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: Callable[[list[Entity], bool], None],
) -> None:

View File

@ -3,9 +3,9 @@ import asyncio
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.typing import HomeAssistantType
from .const import DOMAIN, PLATFORMS
from .onewirehub import CannotConnect, OneWireHub
@ -13,7 +13,7 @@ from .onewirehub import CannotConnect, OneWireHub
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry):
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
"""Set up a 1-Wire proxy for a config entry."""
hass.data.setdefault(DOMAIN, {})
@ -65,7 +65,7 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry):
return True
async def async_unload_entry(hass: HomeAssistantType, config_entry: ConfigEntry):
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(

View File

@ -3,7 +3,7 @@ import voluptuous as vol
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TYPE
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from .const import (
CONF_MOUNT_DIR,
@ -33,7 +33,7 @@ DATA_SCHEMA_MOUNTDIR = vol.Schema(
)
async def validate_input_owserver(hass: HomeAssistantType, data):
async def validate_input_owserver(hass: HomeAssistant, data):
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA_OWSERVER with values provided by the user.
@ -50,7 +50,7 @@ async def validate_input_owserver(hass: HomeAssistantType, data):
return {"title": host}
def is_duplicate_owserver_entry(hass: HomeAssistantType, user_input):
def is_duplicate_owserver_entry(hass: HomeAssistant, user_input):
"""Check existing entries for matching host and port."""
for config_entry in hass.config_entries.async_entries(DOMAIN):
if (
@ -62,7 +62,7 @@ def is_duplicate_owserver_entry(hass: HomeAssistantType, user_input):
return False
async def validate_input_mount_dir(hass: HomeAssistantType, data):
async def validate_input_mount_dir(hass: HomeAssistant, data):
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA_MOUNTDIR with values provided by the user.

View File

@ -6,8 +6,8 @@ from pyownet import protocol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TYPE
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.typing import HomeAssistantType
from .const import CONF_MOUNT_DIR, CONF_TYPE_OWSERVER, CONF_TYPE_SYSBUS
@ -20,7 +20,7 @@ DEVICE_COUPLERS = {
class OneWireHub:
"""Hub to communicate with SysBus or OWServer."""
def __init__(self, hass: HomeAssistantType):
def __init__(self, hass: HomeAssistant):
"""Initialize."""
self.hass = hass
self.type: str = None

View File

@ -12,8 +12,9 @@ from ovoenergy.ovoenergy import OVOEnergy
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
@ -25,7 +26,7 @@ from .const import DATA_CLIENT, DATA_COORDINATOR, DOMAIN
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up OVO Energy from a config entry."""
client = OVOEnergy()
@ -81,7 +82,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
return True
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigType) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigType) -> bool:
"""Unload OVO Energy config entry."""
# Unload sensors
await hass.config_entries.async_forward_entry_unload(entry, "sensor")

View File

@ -6,7 +6,7 @@ from ovoenergy.ovoenergy import OVOEnergy
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from . import OVOEnergyDeviceEntity
@ -17,7 +17,7 @@ PARALLEL_UPDATES = 4
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up OVO Energy sensor based on a config entry."""
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][

View File

@ -49,7 +49,7 @@ from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.storage import Store
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass
_LOGGER = logging.getLogger(__name__)
@ -259,7 +259,7 @@ class PersonStorageCollection(collection.StorageCollection):
raise ValueError("User already taken")
async def filter_yaml_data(hass: HomeAssistantType, persons: list[dict]) -> list[dict]:
async def filter_yaml_data(hass: HomeAssistant, persons: list[dict]) -> list[dict]:
"""Validate YAML data that we can't validate via schema."""
filtered = []
person_invalid_user = []
@ -293,7 +293,7 @@ The following persons point at invalid users:
return filtered
async def async_setup(hass: HomeAssistantType, config: ConfigType):
async def async_setup(hass: HomeAssistant, config: ConfigType):
"""Set up the person component."""
entity_component = EntityComponent(_LOGGER, DOMAIN, hass)
id_manager = collection.IDManager()
@ -514,7 +514,7 @@ class Person(RestoreEntity):
@websocket_api.websocket_command({vol.Required(CONF_TYPE): "person/list"})
def ws_list_person(
hass: HomeAssistantType, connection: websocket_api.ActiveConnection, msg
hass: HomeAssistant, connection: websocket_api.ActiveConnection, msg
):
"""List persons."""
yaml, storage = hass.data[DOMAIN]

View File

@ -3,13 +3,12 @@
from homeassistant.components.group import GroupIntegrationRegistry
from homeassistant.const import STATE_HOME, STATE_NOT_HOME
from homeassistant.core import callback
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant, callback
@callback
def async_describe_on_off_states(
hass: HomeAssistantType, registry: GroupIntegrationRegistry
hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None:
"""Describe group on off states."""
registry.on_off_states({STATE_HOME}, STATE_NOT_HOME)

View File

@ -18,7 +18,6 @@ from homeassistant.const import (
)
from homeassistant.core import CALLBACK_TYPE, Context, HassJob, HomeAssistant, callback
from homeassistant.helpers.debounce import Debouncer
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import DOMAIN
@ -96,7 +95,7 @@ class PluggableAction:
return _remove
async def async_run(self, hass: HomeAssistantType, context: Context | None = None):
async def async_run(self, hass: HomeAssistant, context: Context | None = None):
"""Run all turn on triggers."""
for job, variables in self._actions.values():
hass.async_run_hass_job(job, variables, context)

View File

@ -43,9 +43,8 @@ from homeassistant.const import (
STATE_OFF,
STATE_ON,
)
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import LOGGER as _LOGGER, PhilipsTVDataUpdateCoordinator
@ -104,7 +103,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async def async_setup_entry(
hass: HomeAssistantType,
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
async_add_entities,
):

View File

@ -3,13 +3,12 @@
from homeassistant.components.group import GroupIntegrationRegistry
from homeassistant.const import STATE_OK, STATE_PROBLEM
from homeassistant.core import callback
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant, callback
@callback
def async_describe_on_off_states(
hass: HomeAssistantType, registry: GroupIntegrationRegistry
hass: HomeAssistant, registry: GroupIntegrationRegistry
) -> None:
"""Describe group on off states."""
registry.on_off_states({STATE_PROBLEM}, STATE_OK)

View File

@ -13,6 +13,7 @@ from homeassistant.const import (
CONF_TOKEN,
CONF_WEBHOOK_ID,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
@ -20,7 +21,6 @@ from homeassistant.helpers.dispatcher import (
)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.util.dt import as_local, parse_datetime, utc_from_timestamp
from . import config_flow
@ -74,7 +74,7 @@ async def async_setup(hass, config):
return True
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Point from a config entry."""
async def token_saver(token, **kwargs):
@ -107,7 +107,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
return True
async def async_setup_webhook(hass: HomeAssistantType, entry: ConfigEntry, session):
async def async_setup_webhook(hass: HomeAssistant, entry: ConfigEntry, session):
"""Set up a webhook to handle binary sensor events."""
if CONF_WEBHOOK_ID not in entry.data:
webhook_id = hass.components.webhook.async_generate_id()
@ -133,7 +133,7 @@ async def async_setup_webhook(hass: HomeAssistantType, entry: ConfigEntry, sessi
)
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID])
session = hass.data[DOMAIN].pop(entry.entry_id)
@ -165,7 +165,7 @@ async def handle_webhook(hass, webhook_id, request):
class MinutPointClient:
"""Get the latest data and update the states."""
def __init__(self, hass: HomeAssistantType, config_entry: ConfigEntry, session):
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, session):
"""Initialize the Minut data object."""
self._known_devices = set()
self._known_homes = set()