Integrations: HomeAssistantType --> HomeAssistant. Last batch. (#49591)

This commit is contained in:
jan iversen 2021-04-23 10:34:02 +02:00 committed by GitHub
parent 968460099a
commit d168749a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 44 additions and 50 deletions

View File

@ -13,7 +13,7 @@ from garminconnect import (
from homeassistant.components.sensor import SensorEntity from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION, CONF_ID from homeassistant.const import ATTR_ATTRIBUTION, CONF_ID
from homeassistant.helpers.typing import HomeAssistantType from homeassistant.core import HomeAssistant
from .alarm_util import calculate_next_active_alarms from .alarm_util import calculate_next_active_alarms
from .const import ATTRIBUTION, DOMAIN, GARMIN_ENTITY_LIST from .const import ATTRIBUTION, DOMAIN, GARMIN_ENTITY_LIST
@ -22,7 +22,7 @@ _LOGGER = logging.getLogger(__name__)
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None: ) -> None:
"""Set up Garmin Connect sensor based on a config entry.""" """Set up Garmin Connect sensor based on a config entry."""
garmin_data = hass.data[DOMAIN][entry.entry_id] garmin_data = hass.data[DOMAIN][entry.entry_id]

View File

@ -19,7 +19,7 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
TEMP_CELSIUS, TEMP_CELSIUS,
) )
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.discovery import async_load_platform
@ -30,7 +30,7 @@ from homeassistant.helpers.dispatcher import (
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.service import verify_domain_control from homeassistant.helpers.service import verify_domain_control
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.helpers.typing import ConfigType
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -96,7 +96,7 @@ SET_ZONE_OVERRIDE_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Create a Genius Hub system.""" """Create a Genius Hub system."""
hass.data[DOMAIN] = {} hass.data[DOMAIN] = {}
@ -129,7 +129,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
@callback @callback
def setup_service_functions(hass: HomeAssistantType, broker): def setup_service_functions(hass: HomeAssistant, broker):
"""Set up the service functions.""" """Set up the service functions."""
@verify_domain_control(hass, DOMAIN) @verify_domain_control(hass, DOMAIN)

View File

@ -1,6 +1,7 @@
"""Support for Genius Hub binary_sensor devices.""" """Support for Genius Hub binary_sensor devices."""
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from . import DOMAIN, GeniusDevice from . import DOMAIN, GeniusDevice
@ -8,7 +9,7 @@ GH_STATE_ATTR = "outputOnOff"
async def async_setup_platform( 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
) -> None: ) -> None:
"""Set up the Genius Hub sensor entities.""" """Set up the Genius Hub sensor entities."""
if discovery_info is None: if discovery_info is None:

View File

@ -13,7 +13,8 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from . import DOMAIN, GeniusHeatingZone from . import DOMAIN, GeniusHeatingZone
@ -28,7 +29,7 @@ GH_ZONES = ["radiator", "wet underfloor"]
async def async_setup_platform( 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
) -> None: ) -> None:
"""Set up the Genius Hub climate entities.""" """Set up the Genius Hub climate entities."""
if discovery_info is None: if discovery_info is None:

View File

@ -6,7 +6,8 @@ from typing import Any
from homeassistant.components.sensor import SensorEntity from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from . import DOMAIN, GeniusDevice, GeniusEntity from . import DOMAIN, GeniusDevice, GeniusEntity
@ -21,7 +22,7 @@ GH_LEVEL_MAPPING = {
async def async_setup_platform( 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
) -> None: ) -> None:
"""Set up the Genius Hub sensor entities.""" """Set up the Genius Hub sensor entities."""
if discovery_info is None: if discovery_info is None:

View File

@ -5,8 +5,9 @@ import voluptuous as vol
from homeassistant.components.switch import DEVICE_CLASS_OUTLET, SwitchEntity from homeassistant.components.switch import DEVICE_CLASS_OUTLET, SwitchEntity
from homeassistant.const import ATTR_ENTITY_ID from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.helpers.typing import ConfigType
from . import ATTR_DURATION, DOMAIN, GeniusZone from . import ATTR_DURATION, DOMAIN, GeniusZone
@ -26,7 +27,7 @@ SET_SWITCH_OVERRIDE_SCHEMA = vol.Schema(
async def async_setup_platform( 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
) -> None: ) -> None:
"""Set up the Genius Hub switch entities.""" """Set up the Genius Hub switch entities."""
if discovery_info is None: if discovery_info is None:

View File

@ -7,7 +7,8 @@ from homeassistant.components.water_heater import (
WaterHeaterEntity, WaterHeaterEntity,
) )
from homeassistant.const import STATE_OFF from homeassistant.const import STATE_OFF
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from . import DOMAIN, GeniusHeatingZone from . import DOMAIN, GeniusHeatingZone
@ -32,7 +33,7 @@ GH_HEATERS = ["hot water temperature"]
async def async_setup_platform( 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
) -> None: ) -> None:
"""Set up the Genius Hub water_heater entities.""" """Set up the Genius Hub water_heater entities."""
if discovery_info is None: if discovery_info is None:

View File

@ -7,11 +7,10 @@ from homeassistant.const import (
ATTR_LATITUDE, ATTR_LATITUDE,
ATTR_LONGITUDE, ATTR_LONGITUDE,
) )
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import device_registry from homeassistant.helpers import device_registry
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import HomeAssistantType
from . import DOMAIN as GPL_DOMAIN, TRACKER_UPDATE from . import DOMAIN as GPL_DOMAIN, TRACKER_UPDATE
from .const import ( from .const import (
@ -23,7 +22,7 @@ from .const import (
) )
async def async_setup_entry(hass: HomeAssistantType, entry, async_add_entities): async def async_setup_entry(hass: HomeAssistant, entry, async_add_entities):
"""Configure a dispatcher connection based on a config entry.""" """Configure a dispatcher connection based on a config entry."""
@callback @callback

View File

@ -19,12 +19,9 @@ from homeassistant.const import (
DEVICE_CLASS_TIMESTAMP, DEVICE_CLASS_TIMESTAMP,
STATE_UNKNOWN, STATE_UNKNOWN,
) )
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ( from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
ConfigType,
DiscoveryInfoType,
HomeAssistantType,
)
from homeassistant.util import slugify from homeassistant.util import slugify
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -482,7 +479,7 @@ def get_next_departure(
def setup_platform( def setup_platform(
hass: HomeAssistantType, hass: HomeAssistant,
config: ConfigType, config: ConfigType,
add_entities: Callable[[list], None], add_entities: Callable[[list], None],
discovery_info: DiscoveryInfoType | None = None, discovery_info: DiscoveryInfoType | None = None,

View File

@ -24,7 +24,6 @@ from homeassistant.core import DOMAIN as HASS_DOMAIN, Config, HomeAssistant, cal
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import DeviceRegistry, async_get_registry from homeassistant.helpers.device_registry import DeviceRegistry, async_get_registry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
from homeassistant.util.dt import utcnow from homeassistant.util.dt import utcnow
@ -152,7 +151,7 @@ MAP_SERVICE_API = {
@bind_hass @bind_hass
async def async_get_addon_info(hass: HomeAssistantType, slug: str) -> dict: async def async_get_addon_info(hass: HomeAssistant, slug: str) -> dict:
"""Return add-on info. """Return add-on info.
The caller of the function should handle HassioAPIError. The caller of the function should handle HassioAPIError.
@ -162,7 +161,7 @@ async def async_get_addon_info(hass: HomeAssistantType, slug: str) -> dict:
@bind_hass @bind_hass
async def async_update_diagnostics(hass: HomeAssistantType, diagnostics: bool) -> dict: async def async_update_diagnostics(hass: HomeAssistant, diagnostics: bool) -> dict:
"""Update Supervisor diagnostics toggle. """Update Supervisor diagnostics toggle.
The caller of the function should handle HassioAPIError. The caller of the function should handle HassioAPIError.
@ -173,7 +172,7 @@ async def async_update_diagnostics(hass: HomeAssistantType, diagnostics: bool) -
@bind_hass @bind_hass
@api_data @api_data
async def async_install_addon(hass: HomeAssistantType, slug: str) -> dict: async def async_install_addon(hass: HomeAssistant, slug: str) -> dict:
"""Install add-on. """Install add-on.
The caller of the function should handle HassioAPIError. The caller of the function should handle HassioAPIError.
@ -185,7 +184,7 @@ async def async_install_addon(hass: HomeAssistantType, slug: str) -> dict:
@bind_hass @bind_hass
@api_data @api_data
async def async_uninstall_addon(hass: HomeAssistantType, slug: str) -> dict: async def async_uninstall_addon(hass: HomeAssistant, slug: str) -> dict:
"""Uninstall add-on. """Uninstall add-on.
The caller of the function should handle HassioAPIError. The caller of the function should handle HassioAPIError.
@ -197,7 +196,7 @@ async def async_uninstall_addon(hass: HomeAssistantType, slug: str) -> dict:
@bind_hass @bind_hass
@api_data @api_data
async def async_update_addon(hass: HomeAssistantType, slug: str) -> dict: async def async_update_addon(hass: HomeAssistant, slug: str) -> dict:
"""Update add-on. """Update add-on.
The caller of the function should handle HassioAPIError. The caller of the function should handle HassioAPIError.
@ -209,7 +208,7 @@ async def async_update_addon(hass: HomeAssistantType, slug: str) -> dict:
@bind_hass @bind_hass
@api_data @api_data
async def async_start_addon(hass: HomeAssistantType, slug: str) -> dict: async def async_start_addon(hass: HomeAssistant, slug: str) -> dict:
"""Start add-on. """Start add-on.
The caller of the function should handle HassioAPIError. The caller of the function should handle HassioAPIError.
@ -221,7 +220,7 @@ async def async_start_addon(hass: HomeAssistantType, slug: str) -> dict:
@bind_hass @bind_hass
@api_data @api_data
async def async_stop_addon(hass: HomeAssistantType, slug: str) -> dict: async def async_stop_addon(hass: HomeAssistant, slug: str) -> dict:
"""Stop add-on. """Stop add-on.
The caller of the function should handle HassioAPIError. The caller of the function should handle HassioAPIError.
@ -234,7 +233,7 @@ async def async_stop_addon(hass: HomeAssistantType, slug: str) -> dict:
@bind_hass @bind_hass
@api_data @api_data
async def async_set_addon_options( async def async_set_addon_options(
hass: HomeAssistantType, slug: str, options: dict hass: HomeAssistant, slug: str, options: dict
) -> dict: ) -> dict:
"""Set add-on options. """Set add-on options.
@ -246,9 +245,7 @@ async def async_set_addon_options(
@bind_hass @bind_hass
async def async_get_addon_discovery_info( async def async_get_addon_discovery_info(hass: HomeAssistant, slug: str) -> dict | None:
hass: HomeAssistantType, slug: str
) -> dict | None:
"""Return discovery data for an add-on.""" """Return discovery data for an add-on."""
hassio = hass.data[DOMAIN] hassio = hass.data[DOMAIN]
data = await hassio.retrieve_discovery_messages() data = await hassio.retrieve_discovery_messages()
@ -259,7 +256,7 @@ async def async_get_addon_discovery_info(
@bind_hass @bind_hass
@api_data @api_data
async def async_create_snapshot( async def async_create_snapshot(
hass: HomeAssistantType, payload: dict, partial: bool = False hass: HomeAssistant, payload: dict, partial: bool = False
) -> dict: ) -> dict:
"""Create a full or partial snapshot. """Create a full or partial snapshot.
@ -536,9 +533,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
return True return True
async def async_unload_entry( async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
hass: HomeAssistantType, config_entry: ConfigEntry
) -> bool:
"""Unload a config entry.""" """Unload a config entry."""
unload_ok = all( unload_ok = all(
await asyncio.gather( await asyncio.gather(

View File

@ -6,7 +6,7 @@ from aiohttp import web
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
from homeassistant.const import ATTR_ICON, HTTP_BAD_REQUEST from homeassistant.const import ATTR_ICON, HTTP_BAD_REQUEST
from homeassistant.helpers.typing import HomeAssistantType from homeassistant.core import HomeAssistant
from .const import ATTR_ADMIN, ATTR_ENABLE, ATTR_PANELS, ATTR_TITLE from .const import ATTR_ADMIN, ATTR_ENABLE, ATTR_PANELS, ATTR_TITLE
from .handler import HassioAPIError from .handler import HassioAPIError
@ -14,7 +14,7 @@ from .handler import HassioAPIError
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup_addon_panel(hass: HomeAssistantType, hassio): async def async_setup_addon_panel(hass: HomeAssistant, hassio):
"""Add-on Ingress Panel setup.""" """Add-on Ingress Panel setup."""
hassio_addon_panel = HassIOAddonPanel(hass, hassio) hassio_addon_panel = HassIOAddonPanel(hass, hassio)
hass.http.register_view(hassio_addon_panel) hass.http.register_view(hassio_addon_panel)

View File

@ -13,9 +13,8 @@ from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.const import KEY_HASS_USER from homeassistant.components.http.const import KEY_HASS_USER
from homeassistant.components.http.data_validator import RequestDataValidator from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.const import HTTP_OK from homeassistant.const import HTTP_OK
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import HomeAssistantType
from .const import ATTR_ADDON, ATTR_PASSWORD, ATTR_USERNAME from .const import ATTR_ADDON, ATTR_PASSWORD, ATTR_USERNAME
@ -23,7 +22,7 @@ _LOGGER = logging.getLogger(__name__)
@callback @callback
def async_setup_auth_view(hass: HomeAssistantType, user: User): def async_setup_auth_view(hass: HomeAssistant, user: User):
"""Auth setup.""" """Auth setup."""
hassio_auth = HassIOAuth(hass, user) hassio_auth = HassIOAuth(hass, user)
hassio_password_reset = HassIOPasswordReset(hass, user) hassio_password_reset = HassIOPasswordReset(hass, user)
@ -35,7 +34,7 @@ def async_setup_auth_view(hass: HomeAssistantType, user: User):
class HassIOBaseAuth(HomeAssistantView): class HassIOBaseAuth(HomeAssistantView):
"""Hass.io view to handle auth requests.""" """Hass.io view to handle auth requests."""
def __init__(self, hass: HomeAssistantType, user: User): def __init__(self, hass: HomeAssistant, user: User):
"""Initialize WebView.""" """Initialize WebView."""
self.hass = hass self.hass = hass
self.user = user self.user = user

View File

@ -12,8 +12,7 @@ from aiohttp.web_exceptions import HTTPBadGateway
from multidict import CIMultiDict from multidict import CIMultiDict
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.typing import HomeAssistantType
from .const import X_HASSIO, X_INGRESS_PATH from .const import X_HASSIO, X_INGRESS_PATH
@ -21,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
@callback @callback
def async_setup_ingress_view(hass: HomeAssistantType, host: str): def async_setup_ingress_view(hass: HomeAssistant, host: str):
"""Auth setup.""" """Auth setup."""
websession = hass.helpers.aiohttp_client.async_get_clientsession() websession = hass.helpers.aiohttp_client.async_get_clientsession()