Integrations i* - m*: Rename HomeAssistantType to HomeAssistant. (#49586)

This commit is contained in:
jan iversen 2021-04-23 09:55:20 +02:00 committed by GitHub
parent 017e32a0cb
commit d52bc2373f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 94 additions and 98 deletions

View file

@ -18,9 +18,9 @@ from homeassistant.const import (
CONF_USERNAME,
TEMP_CELSIUS,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import HomeAssistantType
from .const import (
ATTR_CONTROLLER_ID,
@ -284,9 +284,7 @@ def get_manual_configuration(hass, config, conf, ihc_controller, controller_id):
discovery.load_platform(hass, platform, DOMAIN, discovery_info, config)
def autosetup_ihc_products(
hass: HomeAssistantType, config, ihc_controller, controller_id
):
def autosetup_ihc_products(hass: HomeAssistant, config, ihc_controller, controller_id):
"""Auto setup of IHC products from the IHC project file."""
project_xml = ihc_controller.get_project()
if not project_xml:
@ -343,7 +341,7 @@ def get_discovery_info(platform_setup, groups, controller_id):
return discovery_data
def setup_service_functions(hass: HomeAssistantType):
def setup_service_functions(hass: HomeAssistant):
"""Set up the IHC service functions."""
def _get_controller(call):

View file

@ -23,16 +23,17 @@ from homeassistant.const import (
CONF_SSL,
CONF_VERIFY_SSL,
)
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultDict
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import ConfigType
from .const import CONF_BASE_PATH, CONF_SERIAL, CONF_UUID, DOMAIN
_LOGGER = logging.getLogger(__name__)
async def validate_input(hass: HomeAssistantType, data: dict) -> dict[str, Any]:
async 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

@ -7,8 +7,8 @@ from typing import Any, Callable
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_LOCATION, DEVICE_CLASS_TIMESTAMP, PERCENTAGE
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 IPPDataUpdateCoordinator, IPPEntity
@ -27,7 +27,7 @@ from .const import (
async def async_setup_entry(
hass: HomeAssistantType,
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: Callable[[list[Entity], bool], None],
) -> None:

View file

@ -13,12 +13,11 @@ from homeassistant.const import (
CONF_UNIT_OF_MEASUREMENT,
SERVICE_RELOAD,
)
from homeassistant.core import ServiceCall, callback
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.helpers import entity_platform
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import async_get_platforms
import homeassistant.helpers.entity_registry as er
from homeassistant.helpers.typing import HomeAssistantType
from .const import (
_LOGGER,
@ -158,7 +157,7 @@ SERVICE_RUN_NETWORK_RESOURCE_SCHEMA = vol.All(
@callback
def async_setup_services(hass: HomeAssistantType):
def async_setup_services(hass: HomeAssistant):
"""Create and register services for the ISY integration."""
existing_services = hass.services.async_services().get(DOMAIN)
if existing_services and any(
@ -380,7 +379,7 @@ def async_setup_services(hass: HomeAssistantType):
@callback
def async_unload_services(hass: HomeAssistantType):
def async_unload_services(hass: HomeAssistant):
"""Unload services for the ISY integration."""
if hass.data[DOMAIN]:
# There is still another config entry for this domain, don't remove services.
@ -404,7 +403,7 @@ def async_unload_services(hass: HomeAssistantType):
@callback
def async_setup_light_services(hass: HomeAssistantType):
def async_setup_light_services(hass: HomeAssistant):
"""Create device-specific services for the ISY Integration."""
platform = entity_platform.current_platform.get()

View file

@ -5,7 +5,7 @@ from pyisy.constants import ISY_VALUE_UNKNOWN, PROTO_GROUP
from homeassistant.components.switch import DOMAIN as SWITCH, SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from .const import _LOGGER, DOMAIN as ISY994_DOMAIN, ISY994_NODES, ISY994_PROGRAMS
from .entity import ISYNodeEntity, ISYProgramEntity
@ -13,7 +13,7 @@ from .helpers import migrate_old_unique_ids
async def async_setup_entry(
hass: HomeAssistantType,
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: Callable[[list], None],
) -> bool:

View file

@ -3,8 +3,9 @@ import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_EXCLUDE
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import ConfigType
from .const import DATA_CONFIG, IZONE
from .discovery import async_start_discovery_service, async_stop_discovery_service
@ -23,7 +24,7 @@ CONFIG_SCHEMA = vol.Schema(
)
async def async_setup(hass: HomeAssistantType, config: ConfigType):
async def async_setup(hass: HomeAssistant, config: ConfigType):
"""Register the iZone component config."""
conf = config.get(IZONE)
if not conf:

View file

@ -31,11 +31,11 @@ from homeassistant.const import (
PRECISION_TENTHS,
TEMP_CELSIUS,
)
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_platform
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.temperature import display_temp as show_temp
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import ConfigType
from .const import (
DATA_CONFIG,
@ -70,7 +70,7 @@ IZONE_SERVICE_AIRFLOW_SCHEMA = {
async def async_setup_entry(
hass: HomeAssistantType, config: ConfigType, async_add_entities
hass: HomeAssistant, config: ConfigType, async_add_entities
):
"""Initialize an IZone Controller."""
disco = hass.data[DATA_DISCOVERY_SERVICE]

View file

@ -2,9 +2,9 @@
import pizone
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HomeAssistant
from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import HomeAssistantType
from .const import (
DATA_DISCOVERY_SERVICE,
@ -47,7 +47,7 @@ class DiscoveryService(pizone.Listener):
async_dispatcher_send(self.hass, DISPATCH_ZONE_UPDATE, ctrl, zone)
async def async_start_discovery_service(hass: HomeAssistantType):
async def async_start_discovery_service(hass: HomeAssistant):
"""Set up the pizone internal discovery."""
disco = hass.data.get(DATA_DISCOVERY_SERVICE)
if disco:
@ -73,7 +73,7 @@ async def async_start_discovery_service(hass: HomeAssistantType):
return disco
async def async_stop_discovery_service(hass: HomeAssistantType):
async def async_stop_discovery_service(hass: HomeAssistant):
"""Stop the discovery service."""
disco = hass.data.get(DATA_DISCOVERY_SERVICE)
if not disco:

View file

@ -18,9 +18,9 @@ from homeassistant.components.light import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.typing import HomeAssistantType
import homeassistant.util.color as color_util
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
@ -33,7 +33,7 @@ DISCOVERY_INTERVAL = timedelta(seconds=60)
async def async_setup_entry(
hass: HomeAssistantType,
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: Callable[[list[Entity], bool], None],
) -> None:

View file

@ -3,13 +3,12 @@
from homeassistant.components.group import GroupIntegrationRegistry
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
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_LOCKED}, STATE_UNLOCKED)

View file

@ -13,8 +13,7 @@ from homeassistant.const import (
STATE_LOCKED,
STATE_UNLOCKED,
)
from homeassistant.core import Context, State
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import Context, HomeAssistant, State
from . import DOMAIN
@ -24,7 +23,7 @@ VALID_STATES = {STATE_LOCKED, STATE_UNLOCKED}
async def _async_reproduce_state(
hass: HomeAssistantType,
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
@ -60,7 +59,7 @@ async def _async_reproduce_state(
async def async_reproduce_states(
hass: HomeAssistantType,
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,

View file

@ -6,11 +6,11 @@ import voluptuous as vol
from homeassistant.components import frontend
from homeassistant.config import async_hass_config_yaml, async_process_component_config
from homeassistant.const import CONF_FILENAME, CONF_MODE, CONF_RESOURCES
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import collection, config_validation as cv
from homeassistant.helpers.service import async_register_admin_service
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceCallType
from homeassistant.helpers.typing import ConfigType, ServiceCallType
from homeassistant.loader import async_get_integration
from . import dashboard, resources, websocket
@ -67,7 +67,7 @@ CONFIG_SCHEMA = vol.Schema(
)
async def async_setup(hass: HomeAssistantType, config: ConfigType):
async def async_setup(hass: HomeAssistant, config: ConfigType):
"""Set up the Lovelace commands."""
mode = config[DOMAIN][CONF_MODE]
yaml_resources = config[DOMAIN].get(CONF_RESOURCES)

View file

@ -25,10 +25,10 @@ from homeassistant.components.climate.const import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity_platform
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from . import LyricDeviceEntity
@ -88,7 +88,7 @@ SCHEMA_HOLD_TIME = {
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the Honeywell Lyric climate platform based on a config entry."""
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]

View file

@ -11,7 +11,7 @@ from homeassistant.const import (
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_TIMESTAMP,
)
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.util import dt as dt_util
@ -34,7 +34,7 @@ LYRIC_SETPOINT_STATUS_NAMES = {
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the Honeywell Lyric sensor platform based on a config entry."""
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]

View file

@ -9,13 +9,12 @@ from homeassistant.const import (
STATE_PAUSED,
STATE_PLAYING,
)
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(

View file

@ -19,8 +19,7 @@ from homeassistant.const import (
STATE_PAUSED,
STATE_PLAYING,
)
from homeassistant.core import Context, State
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import Context, HomeAssistant, State
from .const import (
ATTR_INPUT_SOURCE,
@ -40,7 +39,7 @@ from .const import (
async def _async_reproduce_states(
hass: HomeAssistantType,
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
@ -104,7 +103,7 @@ async def _async_reproduce_states(
async def async_reproduce_states(
hass: HomeAssistantType,
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,

View file

@ -9,9 +9,10 @@ import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
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.helpers.update_coordinator import DataUpdateCoordinator
from .const import (
@ -38,7 +39,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 Meteo-France from legacy config file."""
conf = config.get(DOMAIN)
if not conf:
@ -54,7 +55,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 Meteo-France account from a config entry."""
hass.data.setdefault(DOMAIN, {})
@ -180,7 +181,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
return True
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
if hass.data[DOMAIN][entry.entry_id][COORDINATOR_ALERT]:
@ -210,6 +211,6 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
return unload_ok
async def _async_update_listener(hass: HomeAssistantType, entry: ConfigEntry):
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry):
"""Handle options update."""
await hass.config_entries.async_reload(entry.entry_id)

View file

@ -9,7 +9,7 @@ from meteofrance_api.helpers import (
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
@ -39,7 +39,7 @@ _LOGGER = logging.getLogger(__name__)
async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the Meteo-France sensor platform."""
coordinator_forecast = hass.data[DOMAIN][entry.entry_id][COORDINATOR_FORECAST]

View file

@ -35,7 +35,7 @@ from homeassistant.const import (
CONF_PORT,
CONF_USERNAME,
)
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from .const import (
MOCK_HOSTNAME,
@ -93,7 +93,7 @@ async def _device_form(hass, flow_id, connection, user_input):
return result, mock_setup, mock_setup_entry
async def test_form_select_modem(hass: HomeAssistantType):
async def test_form_select_modem(hass: HomeAssistant):
"""Test we get a modem form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, HUB2)
@ -101,7 +101,7 @@ async def test_form_select_modem(hass: HomeAssistantType):
assert result["type"] == "form"
async def test_fail_on_existing(hass: HomeAssistantType):
async def test_fail_on_existing(hass: HomeAssistant):
"""Test we fail if the integration is already configured."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -121,7 +121,7 @@ async def test_fail_on_existing(hass: HomeAssistantType):
assert result["reason"] == "single_instance_allowed"
async def test_form_select_plm(hass: HomeAssistantType):
async def test_form_select_plm(hass: HomeAssistant):
"""Test we set up the PLM correctly."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, PLM)
@ -136,7 +136,7 @@ async def test_form_select_plm(hass: HomeAssistantType):
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_select_hub_v1(hass: HomeAssistantType):
async def test_form_select_hub_v1(hass: HomeAssistant):
"""Test we set up the Hub v1 correctly."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, HUB1)
@ -154,7 +154,7 @@ async def test_form_select_hub_v1(hass: HomeAssistantType):
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_select_hub_v2(hass: HomeAssistantType):
async def test_form_select_hub_v2(hass: HomeAssistant):
"""Test we set up the Hub v2 correctly."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, HUB2)
@ -172,7 +172,7 @@ async def test_form_select_hub_v2(hass: HomeAssistantType):
assert len(mock_setup_entry.mock_calls) == 1
async def test_failed_connection_plm(hass: HomeAssistantType):
async def test_failed_connection_plm(hass: HomeAssistant):
"""Test a failed connection with the PLM."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, PLM)
@ -184,7 +184,7 @@ async def test_failed_connection_plm(hass: HomeAssistantType):
assert result2["errors"] == {"base": "cannot_connect"}
async def test_failed_connection_hub(hass: HomeAssistantType):
async def test_failed_connection_hub(hass: HomeAssistant):
"""Test a failed connection with a Hub."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await _init_form(hass, HUB2)
@ -206,7 +206,7 @@ async def _import_config(hass, config):
)
async def test_import_plm(hass: HomeAssistantType):
async def test_import_plm(hass: HomeAssistant):
"""Test importing a minimum PLM config from yaml."""
await setup.async_setup_component(hass, "persistent_notification", {})
@ -233,7 +233,7 @@ async def _options_init_form(hass, entry_id, step):
return result2
async def test_import_min_hub_v2(hass: HomeAssistantType):
async def test_import_min_hub_v2(hass: HomeAssistant):
"""Test importing a minimum Hub v2 config from yaml."""
await setup.async_setup_component(hass, "persistent_notification", {})
@ -251,7 +251,7 @@ async def test_import_min_hub_v2(hass: HomeAssistantType):
assert entry.data[CONF_HUB_VERSION] == 2
async def test_import_min_hub_v1(hass: HomeAssistantType):
async def test_import_min_hub_v1(hass: HomeAssistant):
"""Test importing a minimum Hub v1 config from yaml."""
await setup.async_setup_component(hass, "persistent_notification", {})
@ -267,7 +267,7 @@ async def test_import_min_hub_v1(hass: HomeAssistantType):
assert entry.data[CONF_HUB_VERSION] == 1
async def test_import_existing(hass: HomeAssistantType):
async def test_import_existing(hass: HomeAssistant):
"""Test we fail on an existing config imported."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -285,7 +285,7 @@ async def test_import_existing(hass: HomeAssistantType):
assert result["reason"] == "single_instance_allowed"
async def test_import_failed_connection(hass: HomeAssistantType):
async def test_import_failed_connection(hass: HomeAssistant):
"""Test a failed connection on import."""
await setup.async_setup_component(hass, "persistent_notification", {})
@ -310,7 +310,7 @@ async def _options_form(hass, flow_id, user_input):
return result, mock_setup_entry
async def test_options_change_hub_config(hass: HomeAssistantType):
async def test_options_change_hub_config(hass: HomeAssistant):
"""Test changing Hub v2 config."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -337,7 +337,7 @@ async def test_options_change_hub_config(hass: HomeAssistantType):
assert config_entry.data == {**user_input, CONF_HUB_VERSION: 2}
async def test_options_add_device_override(hass: HomeAssistantType):
async def test_options_add_device_override(hass: HomeAssistant):
"""Test adding a device override."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -380,7 +380,7 @@ async def test_options_add_device_override(hass: HomeAssistantType):
assert result["data"] != result3["data"]
async def test_options_remove_device_override(hass: HomeAssistantType):
async def test_options_remove_device_override(hass: HomeAssistant):
"""Test removing a device override."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -404,7 +404,7 @@ async def test_options_remove_device_override(hass: HomeAssistantType):
assert len(config_entry.options[CONF_OVERRIDE]) == 1
async def test_options_remove_device_override_with_x10(hass: HomeAssistantType):
async def test_options_remove_device_override_with_x10(hass: HomeAssistant):
"""Test removing a device override when an X10 device is configured."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -437,7 +437,7 @@ async def test_options_remove_device_override_with_x10(hass: HomeAssistantType):
assert len(config_entry.options[CONF_X10]) == 1
async def test_options_add_x10_device(hass: HomeAssistantType):
async def test_options_add_x10_device(hass: HomeAssistant):
"""Test adding an X10 device."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -484,7 +484,7 @@ async def test_options_add_x10_device(hass: HomeAssistantType):
assert result2["data"] != result3["data"]
async def test_options_remove_x10_device(hass: HomeAssistantType):
async def test_options_remove_x10_device(hass: HomeAssistant):
"""Test removing an X10 device."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -523,7 +523,7 @@ async def test_options_remove_x10_device(hass: HomeAssistantType):
assert len(config_entry.options[CONF_X10]) == 1
async def test_options_remove_x10_device_with_override(hass: HomeAssistantType):
async def test_options_remove_x10_device_with_override(hass: HomeAssistant):
"""Test removing an X10 device when a device override is configured."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -564,7 +564,7 @@ async def test_options_remove_x10_device_with_override(hass: HomeAssistantType):
assert len(config_entry.options[CONF_OVERRIDE]) == 1
async def test_options_dup_selection(hass: HomeAssistantType):
async def test_options_dup_selection(hass: HomeAssistant):
"""Test if a duplicate selection was made in options."""
config_entry = MockConfigEntry(
domain=DOMAIN,
@ -586,7 +586,7 @@ async def test_options_dup_selection(hass: HomeAssistantType):
assert result2["errors"] == {"base": "select_single"}
async def test_options_override_bad_data(hass: HomeAssistantType):
async def test_options_override_bad_data(hass: HomeAssistant):
"""Test for bad data in a device override."""
config_entry = MockConfigEntry(

View file

@ -23,7 +23,7 @@ from homeassistant.const import (
CONF_USERNAME,
EVENT_HOMEASSISTANT_STOP,
)
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from .const import (
@ -54,7 +54,7 @@ async def mock_failed_connection(*args, **kwargs):
raise ConnectionError("Connection failed")
async def test_setup_entry(hass: HomeAssistantType):
async def test_setup_entry(hass: HomeAssistant):
"""Test setting up the entry."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_INPUT_PLM)
config_entry.add_to_hass(hass)
@ -77,7 +77,7 @@ async def test_setup_entry(hass: HomeAssistantType):
assert mock_close.called
async def test_import_plm(hass: HomeAssistantType):
async def test_import_plm(hass: HomeAssistant):
"""Test setting up the entry from YAML to a PLM."""
config = {}
config[DOMAIN] = MOCK_IMPORT_CONFIG_PLM
@ -102,7 +102,7 @@ async def test_import_plm(hass: HomeAssistantType):
assert CONF_PORT not in data
async def test_import_hub1(hass: HomeAssistantType):
async def test_import_hub1(hass: HomeAssistant):
"""Test setting up the entry from YAML to a hub v1."""
config = {}
config[DOMAIN] = MOCK_IMPORT_MINIMUM_HUB_V1
@ -129,7 +129,7 @@ async def test_import_hub1(hass: HomeAssistantType):
assert CONF_PASSWORD not in data
async def test_import_hub2(hass: HomeAssistantType):
async def test_import_hub2(hass: HomeAssistant):
"""Test setting up the entry from YAML to a hub v2."""
config = {}
config[DOMAIN] = MOCK_IMPORT_MINIMUM_HUB_V2
@ -156,7 +156,7 @@ async def test_import_hub2(hass: HomeAssistantType):
assert data[CONF_PASSWORD] == MOCK_IMPORT_MINIMUM_HUB_V2[CONF_PASSWORD]
async def test_import_options(hass: HomeAssistantType):
async def test_import_options(hass: HomeAssistant):
"""Test setting up the entry from YAML including options."""
config = {}
config[DOMAIN] = MOCK_IMPORT_FULL_CONFIG_PLM
@ -189,7 +189,7 @@ async def test_import_options(hass: HomeAssistantType):
assert options[CONF_X10][1] == MOCK_IMPORT_FULL_CONFIG_PLM[CONF_X10][1]
async def test_import_failed_connection(hass: HomeAssistantType):
async def test_import_failed_connection(hass: HomeAssistant):
"""Test a failed connection in import does not create a config entry."""
config = {}
config[DOMAIN] = MOCK_IMPORT_CONFIG_PLM
@ -208,7 +208,7 @@ async def test_import_failed_connection(hass: HomeAssistantType):
assert not hass.config_entries.async_entries(DOMAIN)
async def test_setup_entry_failed_connection(hass: HomeAssistantType, caplog):
async def test_setup_entry_failed_connection(hass: HomeAssistant, caplog):
"""Test setting up the entry with a failed connection."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_INPUT_PLM)
config_entry.add_to_hass(hass)

View file

@ -17,7 +17,7 @@ from homeassistant.components.isy994.const import (
)
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_SSDP
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
@ -70,7 +70,7 @@ PATCH_ASYNC_SETUP = "homeassistant.components.isy994.async_setup"
PATCH_ASYNC_SETUP_ENTRY = "homeassistant.components.isy994.async_setup_entry"
async def test_form(hass: HomeAssistantType):
async def test_form(hass: HomeAssistant):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
@ -103,7 +103,7 @@ async def test_form(hass: HomeAssistantType):
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_invalid_host(hass: HomeAssistantType):
async def test_form_invalid_host(hass: HomeAssistant):
"""Test we handle invalid host."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -123,7 +123,7 @@ async def test_form_invalid_host(hass: HomeAssistantType):
assert result2["errors"] == {"base": "invalid_host"}
async def test_form_invalid_auth(hass: HomeAssistantType):
async def test_form_invalid_auth(hass: HomeAssistant):
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -141,7 +141,7 @@ async def test_form_invalid_auth(hass: HomeAssistantType):
assert result2["errors"] == {"base": "invalid_auth"}
async def test_form_cannot_connect(hass: HomeAssistantType):
async def test_form_cannot_connect(hass: HomeAssistant):
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -159,7 +159,7 @@ async def test_form_cannot_connect(hass: HomeAssistantType):
assert result2["errors"] == {"base": "cannot_connect"}
async def test_form_existing_config_entry(hass: HomeAssistantType):
async def test_form_existing_config_entry(hass: HomeAssistant):
"""Test if config entry already exists."""
MockConfigEntry(domain=DOMAIN, unique_id=MOCK_UUID).add_to_hass(hass)
await setup.async_setup_component(hass, "persistent_notification", {})
@ -182,7 +182,7 @@ async def test_form_existing_config_entry(hass: HomeAssistantType):
assert result2["type"] == data_entry_flow.RESULT_TYPE_ABORT
async def test_import_flow_some_fields(hass: HomeAssistantType) -> None:
async def test_import_flow_some_fields(hass: HomeAssistant) -> None:
"""Test import config flow with just the basic fields."""
with patch(PATCH_CONFIGURATION) as mock_config_class, patch(
PATCH_CONNECTION
@ -205,7 +205,7 @@ async def test_import_flow_some_fields(hass: HomeAssistantType) -> None:
assert result["data"][CONF_PASSWORD] == MOCK_PASSWORD
async def test_import_flow_with_https(hass: HomeAssistantType) -> None:
async def test_import_flow_with_https(hass: HomeAssistant) -> None:
"""Test import config with https."""
with patch(PATCH_CONFIGURATION) as mock_config_class, patch(
@ -229,7 +229,7 @@ async def test_import_flow_with_https(hass: HomeAssistantType) -> None:
assert result["data"][CONF_PASSWORD] == MOCK_PASSWORD
async def test_import_flow_all_fields(hass: HomeAssistantType) -> None:
async def test_import_flow_all_fields(hass: HomeAssistant) -> None:
"""Test import config flow with all fields."""
with patch(PATCH_CONFIGURATION) as mock_config_class, patch(
PATCH_CONNECTION
@ -257,7 +257,7 @@ async def test_import_flow_all_fields(hass: HomeAssistantType) -> None:
assert result["data"][CONF_TLS_VER] == MOCK_TLS_VERSION
async def test_form_ssdp_already_configured(hass: HomeAssistantType) -> None:
async def test_form_ssdp_already_configured(hass: HomeAssistant) -> None:
"""Test ssdp abort when the serial number is already configured."""
await setup.async_setup_component(hass, "persistent_notification", {})
@ -279,7 +279,7 @@ async def test_form_ssdp_already_configured(hass: HomeAssistantType) -> None:
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
async def test_form_ssdp(hass: HomeAssistantType):
async def test_form_ssdp(hass: HomeAssistant):
"""Test we can setup from ssdp."""
await setup.async_setup_component(hass, "persistent_notification", {})

View file

@ -9,7 +9,7 @@ import pytest
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import keenetic_ndms2 as keenetic
from homeassistant.components.keenetic_ndms2 import const
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.core import HomeAssistant
from . import MOCK_DATA, MOCK_NAME, MOCK_OPTIONS
@ -43,7 +43,7 @@ def mock_keenetic_connect_failed():
yield
async def test_flow_works(hass: HomeAssistantType, connect):
async def test_flow_works(hass: HomeAssistant, connect):
"""Test config flow."""
result = await hass.config_entries.flow.async_init(
@ -67,7 +67,7 @@ async def test_flow_works(hass: HomeAssistantType, connect):
assert len(mock_setup_entry.mock_calls) == 1
async def test_import_works(hass: HomeAssistantType, connect):
async def test_import_works(hass: HomeAssistant, connect):
"""Test config flow."""
with patch(