From 6992e24263ba77dafcb0168943c4d6e49360363e Mon Sep 17 00:00:00 2001 From: jan iversen Date: Thu, 22 Apr 2021 16:53:57 +0200 Subject: [PATCH] =?UTF-8?q?Rename=20HomeAssistantType=20=E2=80=94>=20HomeA?= =?UTF-8?q?ssistant,=20integrations=20t*=20-=20v*=20(#49544)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Integration vizio: HomeAssistantType -> HomeAssistant. * Integration velbus: HomeAssistantType -> HomeAssistant. * Integration vacuum: HomeAssistantType -> HomeAssistant. * Integration upnp: HomeAssistantType -> HomeAssistant. * Integration upcloud: HomeAssistantType -> HomeAssistant. * Integration twinkly: HomeAssistantType -> HomeAssistant. * Integration tts: HomeAssistantType -> HomeAssistant. * Integration tradfri: HomeAssistantType -> HomeAssistant. * Integration traccar: HomeAssistantType -> HomeAssistant. * Integration tplink: HomeAssistantType -> HomeAssistant. --- homeassistant/components/tplink/__init__.py | 5 +- homeassistant/components/tplink/common.py | 4 +- homeassistant/components/tplink/light.py | 4 +- homeassistant/components/tplink/switch.py | 4 +- .../components/traccar/device_tracker.py | 5 +- homeassistant/components/tradfri/__init__.py | 9 +-- homeassistant/components/tts/__init__.py | 5 +- homeassistant/components/twinkly/__init__.py | 8 +-- homeassistant/components/twinkly/light.py | 6 +- homeassistant/components/upcloud/__init__.py | 11 ++- homeassistant/components/upnp/__init__.py | 13 ++-- homeassistant/components/upnp/device.py | 10 +-- homeassistant/components/upnp/sensor.py | 6 +- homeassistant/components/vacuum/group.py | 5 +- .../components/vacuum/reproduce_state.py | 7 +- homeassistant/components/velbus/__init__.py | 6 +- homeassistant/components/vizio/__init__.py | 13 ++-- .../components/vizio/media_player.py | 7 +- tests/components/upnp/test_config_flow.py | 18 ++--- tests/components/upnp/test_init.py | 6 +- tests/components/vizio/test_config_flow.py | 70 +++++++++---------- tests/components/vizio/test_init.py | 8 +-- tests/components/vizio/test_media_player.py | 60 ++++++++-------- 23 files changed, 141 insertions(+), 149 deletions(-) diff --git a/homeassistant/components/tplink/__init__.py b/homeassistant/components/tplink/__init__.py index 764060135a2..17b58569c7e 100644 --- a/homeassistant/components/tplink/__init__.py +++ b/homeassistant/components/tplink/__init__.py @@ -5,8 +5,9 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_HOST +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 .common import ( ATTR_CONFIG, @@ -68,7 +69,7 @@ async def async_setup(hass, config): return True -async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigType): +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigType): """Set up TPLink from a config entry.""" config_data = hass.data[DOMAIN].get(ATTR_CONFIG) diff --git a/homeassistant/components/tplink/common.py b/homeassistant/components/tplink/common.py index b9318cf3fdd..4129a80f83c 100644 --- a/homeassistant/components/tplink/common.py +++ b/homeassistant/components/tplink/common.py @@ -12,7 +12,7 @@ from pyHS100 import ( SmartStrip, ) -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from .const import DOMAIN as TPLINK_DOMAIN @@ -67,7 +67,7 @@ async def async_get_discoverable_devices(hass): async def async_discover_devices( - hass: HomeAssistantType, existing_devices: SmartDevices + hass: HomeAssistant, existing_devices: SmartDevices ) -> SmartDevices: """Get devices through discovery.""" _LOGGER.debug("Discovering devices") diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index 8880373955f..0d9db7ba108 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -19,9 +19,9 @@ from homeassistant.components.light import ( SUPPORT_COLOR_TEMP, LightEntity, ) +from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError, PlatformNotReady import homeassistant.helpers.device_registry as dr -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.util.color import ( color_temperature_kelvin_to_mired as kelvin_to_mired, color_temperature_mired_to_kelvin as mired_to_kelvin, @@ -77,7 +77,7 @@ FALLBACK_MIN_COLOR = 2700 FALLBACK_MAX_COLOR = 5000 -async def async_setup_entry(hass: HomeAssistantType, config_entry, async_add_entities): +async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entities): """Set up lights.""" entities = await hass.async_add_executor_job( add_available_devices, hass, CONF_LIGHT, TPLinkSmartBulb diff --git a/homeassistant/components/tplink/switch.py b/homeassistant/components/tplink/switch.py index 11b86d6254f..ab8b3290b30 100644 --- a/homeassistant/components/tplink/switch.py +++ b/homeassistant/components/tplink/switch.py @@ -12,9 +12,9 @@ from homeassistant.components.switch import ( SwitchEntity, ) from homeassistant.const import ATTR_VOLTAGE +from homeassistant.core import HomeAssistant from homeassistant.exceptions import PlatformNotReady import homeassistant.helpers.device_registry as dr -from homeassistant.helpers.typing import HomeAssistantType from . import CONF_SWITCH, DOMAIN as TPLINK_DOMAIN from .common import add_available_devices @@ -30,7 +30,7 @@ MAX_ATTEMPTS = 300 SLEEP_TIME = 2 -async def async_setup_entry(hass: HomeAssistantType, config_entry, async_add_entities): +async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entities): """Set up switches.""" entities = await hass.async_add_executor_job( add_available_devices, hass, CONF_SWITCH, SmartPlugSwitch diff --git a/homeassistant/components/traccar/device_tracker.py b/homeassistant/components/traccar/device_tracker.py index d558129e323..aebbb8b3b6c 100644 --- a/homeassistant/components/traccar/device_tracker.py +++ b/homeassistant/components/traccar/device_tracker.py @@ -19,14 +19,13 @@ from homeassistant.const import ( CONF_USERNAME, CONF_VERIFY_SSL, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import device_registry from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.util import slugify from . import DOMAIN, TRACKER_UPDATE @@ -114,7 +113,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( ) -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.""" @callback diff --git a/homeassistant/components/tradfri/__init__.py b/homeassistant/components/tradfri/__init__.py index 3323c54d9c2..13d6d571300 100644 --- a/homeassistant/components/tradfri/__init__.py +++ b/homeassistant/components/tradfri/__init__.py @@ -10,10 +10,11 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.config_entries import ConfigEntry from homeassistant.const import EVENT_HOMEASSISTANT_STOP +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_track_time_interval -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import ConfigType from homeassistant.util.json import load_json from .const import ( @@ -55,7 +56,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_setup(hass: HomeAssistantType, config: ConfigType): +async def async_setup(hass: HomeAssistant, config: ConfigType): """Set up the Tradfri component.""" conf = config.get(DOMAIN) @@ -100,7 +101,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): """Create a gateway.""" # host, identity, key, allow_tradfri_groups tradfri_data = hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {} @@ -169,7 +170,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.""" unload_ok = all( await asyncio.gather( diff --git a/homeassistant/components/tts/__init__.py b/homeassistant/components/tts/__init__.py index 5922392f17d..f2d72dbe4ad 100644 --- a/homeassistant/components/tts/__init__.py +++ b/homeassistant/components/tts/__init__.py @@ -33,13 +33,12 @@ from homeassistant.const import ( HTTP_NOT_FOUND, PLATFORM_FORMAT, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import config_per_platform, discovery import homeassistant.helpers.config_validation as cv from homeassistant.helpers.network import get_url from homeassistant.helpers.service import async_set_service_schema -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.loader import async_get_integration from homeassistant.setup import async_prepare_setup_platform from homeassistant.util.yaml import load_yaml @@ -519,7 +518,7 @@ class SpeechManager: class Provider: """Represent a single TTS provider.""" - hass: HomeAssistantType | None = None + hass: HomeAssistant | None = None name: str | None = None @property diff --git a/homeassistant/components/twinkly/__init__.py b/homeassistant/components/twinkly/__init__.py index 2b605104609..876d02bd698 100644 --- a/homeassistant/components/twinkly/__init__.py +++ b/homeassistant/components/twinkly/__init__.py @@ -3,19 +3,19 @@ import twinkly_client from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession -from homeassistant.helpers.typing import HomeAssistantType from .const import CONF_ENTRY_HOST, CONF_ENTRY_ID, DOMAIN -async def async_setup(hass: HomeAssistantType, config: dict): +async def async_setup(hass: HomeAssistant, config: dict): """Set up the twinkly integration.""" return True -async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry): +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry): """Set up entries from config flow.""" # We setup the client here so if at some point we add any other entity for this device, @@ -33,7 +33,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): """Remove a twinkly entry.""" # For now light entries don't have unload method, so we don't have to async_forward_entry_unload diff --git a/homeassistant/components/twinkly/light.py b/homeassistant/components/twinkly/light.py index 4353aa2707b..1918839b4b2 100644 --- a/homeassistant/components/twinkly/light.py +++ b/homeassistant/components/twinkly/light.py @@ -13,7 +13,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 .const import ( ATTR_HOST, @@ -31,7 +31,7 @@ _LOGGER = logging.getLogger(__name__) async def async_setup_entry( - hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities + hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities ) -> None: """Setups an entity from a config entry (UI config flow).""" @@ -46,7 +46,7 @@ class TwinklyLight(LightEntity): def __init__( self, conf: ConfigEntry, - hass: HomeAssistantType, + hass: HomeAssistant, ): """Initialize a TwinklyLight entity.""" self._id = conf.data[CONF_ENTRY_ID] diff --git a/homeassistant/components/upcloud/__init__.py b/homeassistant/components/upcloud/__init__.py index f2484135be3..4f13aaa5460 100644 --- a/homeassistant/components/upcloud/__init__.py +++ b/homeassistant/components/upcloud/__init__.py @@ -21,14 +21,13 @@ from homeassistant.const import ( STATE_ON, STATE_PROBLEM, ) -from homeassistant.core import CALLBACK_TYPE +from homeassistant.core import CALLBACK_TYPE, HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import ( async_dispatcher_connect, async_dispatcher_send, ) -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -81,7 +80,7 @@ class UpCloudDataUpdateCoordinator( def __init__( self, - hass: HomeAssistantType, + hass: HomeAssistant, *, cloud_manager: upcloud_api.CloudManager, update_interval: timedelta, @@ -119,7 +118,7 @@ class UpCloudHassData: scan_interval_migrations: dict[str, int] = dataclasses.field(default_factory=dict) -async def async_setup(hass: HomeAssistantType, config) -> bool: +async def async_setup(hass: HomeAssistant, config) -> bool: """Set up UpCloud component.""" domain_config = config.get(DOMAIN) if not domain_config: @@ -155,7 +154,7 @@ def _config_entry_update_signal_name(config_entry: ConfigEntry) -> str: async def _async_signal_options_update( - hass: HomeAssistantType, config_entry: ConfigEntry + hass: HomeAssistant, config_entry: ConfigEntry ) -> None: """Signal config entry options update.""" async_dispatcher_send( @@ -163,7 +162,7 @@ async def _async_signal_options_update( ) -async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool: +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set up the UpCloud config entry.""" manager = upcloud_api.CloudManager( diff --git a/homeassistant/components/upnp/__init__.py b/homeassistant/components/upnp/__init__.py index 439c3a8760b..3b4672a8fe5 100644 --- a/homeassistant/components/upnp/__init__.py +++ b/homeassistant/components/upnp/__init__.py @@ -6,9 +6,10 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import config_validation as cv, device_registry as dr -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import ConfigType from homeassistant.util import get_local_ip from .const import ( @@ -42,7 +43,7 @@ CONFIG_SCHEMA = vol.Schema( ) -async def async_construct_device(hass: HomeAssistantType, udn: str, st: str) -> Device: +async def async_construct_device(hass: HomeAssistant, udn: str, st: str) -> Device: """Discovery devices and construct a Device for one.""" # pylint: disable=invalid-name _LOGGER.debug("Constructing device: %s::%s", udn, st) @@ -66,7 +67,7 @@ async def async_construct_device(hass: HomeAssistantType, udn: str, st: str) -> return await Device.async_create_device(hass, location) -async def async_setup(hass: HomeAssistantType, config: ConfigType): +async def async_setup(hass: HomeAssistant, config: ConfigType): """Set up UPnP component.""" _LOGGER.debug("async_setup, config: %s", config) conf_default = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN] @@ -89,7 +90,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType): return True -async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool: +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Set up UPnP/IGD device from a config entry.""" _LOGGER.debug("Setting up config entry: %s", config_entry.unique_id) @@ -153,9 +154,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 a UPnP/IGD device from a config entry.""" _LOGGER.debug("Unloading config entry: %s", config_entry.unique_id) diff --git a/homeassistant/components/upnp/device.py b/homeassistant/components/upnp/device.py index c116e64ca7f..e5b6099e9f3 100644 --- a/homeassistant/components/upnp/device.py +++ b/homeassistant/components/upnp/device.py @@ -11,8 +11,8 @@ from async_upnp_client.aiohttp import AiohttpSessionRequester from async_upnp_client.device_updater import DeviceUpdater from async_upnp_client.profiles.igd import IgdDevice +from homeassistant.core import HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator import homeassistant.util.dt as dt_util @@ -36,7 +36,7 @@ from .const import ( ) -def _get_local_ip(hass: HomeAssistantType) -> IPv4Address | None: +def _get_local_ip(hass: HomeAssistant) -> IPv4Address | None: """Get the configured local ip.""" if DOMAIN in hass.data and DOMAIN_CONFIG in hass.data[DOMAIN]: local_ip = hass.data[DOMAIN][DOMAIN_CONFIG].get(CONF_LOCAL_IP) @@ -55,7 +55,7 @@ class Device: self.coordinator: DataUpdateCoordinator = None @classmethod - async def async_discover(cls, hass: HomeAssistantType) -> list[Mapping]: + async def async_discover(cls, hass: HomeAssistant) -> list[Mapping]: """Discover UPnP/IGD devices.""" _LOGGER.debug("Discovering UPnP/IGD devices") local_ip = _get_local_ip(hass) @@ -73,7 +73,7 @@ class Device: @classmethod async def async_supplement_discovery( - cls, hass: HomeAssistantType, discovery: Mapping + cls, hass: HomeAssistant, discovery: Mapping ) -> Mapping: """Get additional data from device and supplement discovery.""" location = discovery[DISCOVERY_LOCATION] @@ -86,7 +86,7 @@ class Device: @classmethod async def async_create_device( - cls, hass: HomeAssistantType, ssdp_location: str + cls, hass: HomeAssistant, ssdp_location: str ) -> Device: """Create UPnP/IGD device.""" # Build async_upnp_client requester. diff --git a/homeassistant/components/upnp/sensor.py b/homeassistant/components/upnp/sensor.py index d777b8104cd..3ffcb8d7426 100644 --- a/homeassistant/components/upnp/sensor.py +++ b/homeassistant/components/upnp/sensor.py @@ -7,8 +7,8 @@ from typing import Any, Callable, Mapping from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import DATA_BYTES, DATA_RATE_KIBIBYTES_PER_SECOND +from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -73,7 +73,7 @@ SENSOR_TYPES = { async def async_setup_platform( - hass: HomeAssistantType, config, async_add_entities, discovery_info=None + hass: HomeAssistant, config, async_add_entities, discovery_info=None ) -> None: """Old way of setting up UPnP/IGD sensors.""" _LOGGER.debug( @@ -82,7 +82,7 @@ async def async_setup_platform( async def async_setup_entry( - hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities: Callable + hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable ) -> None: """Set up the UPnP/IGD sensors.""" udn = config_entry.data[CONFIG_ENTRY_UDN] diff --git a/homeassistant/components/vacuum/group.py b/homeassistant/components/vacuum/group.py index 0219ecdf795..e5a1734420f 100644 --- a/homeassistant/components/vacuum/group.py +++ b/homeassistant/components/vacuum/group.py @@ -3,15 +3,14 @@ from homeassistant.components.group import GroupIntegrationRegistry from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.core import callback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant, callback from . import STATE_CLEANING, STATE_ERROR, STATE_RETURNING @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( diff --git a/homeassistant/components/vacuum/reproduce_state.py b/homeassistant/components/vacuum/reproduce_state.py index 4d5a9baf46e..f8d718c9979 100644 --- a/homeassistant/components/vacuum/reproduce_state.py +++ b/homeassistant/components/vacuum/reproduce_state.py @@ -15,8 +15,7 @@ from homeassistant.const import ( STATE_ON, STATE_PAUSED, ) -from homeassistant.core import Context, State -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import Context, HomeAssistant, State from . import ( ATTR_FAN_SPEED, @@ -44,7 +43,7 @@ VALID_STATES_STATE = { async def _async_reproduce_state( - hass: HomeAssistantType, + hass: HomeAssistant, state: State, *, context: Context | None = None, @@ -99,7 +98,7 @@ async def _async_reproduce_state( async def async_reproduce_states( - hass: HomeAssistantType, + hass: HomeAssistant, states: Iterable[State], *, context: Context | None = None, diff --git a/homeassistant/components/velbus/__init__.py b/homeassistant/components/velbus/__init__.py index a15b0a641ef..6d5e741a3ce 100644 --- a/homeassistant/components/velbus/__init__.py +++ b/homeassistant/components/velbus/__init__.py @@ -7,10 +7,10 @@ import voluptuous as vol from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_PORT +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import HomeAssistantType from .const import CONF_MEMO_TEXT, DOMAIN, SERVICE_SET_MEMO_TEXT @@ -44,7 +44,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): """Establish connection with velbus.""" hass.data.setdefault(DOMAIN, {}) @@ -109,7 +109,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): """Remove the velbus connection.""" await asyncio.wait( [ diff --git a/homeassistant/components/vizio/__init__.py b/homeassistant/components/vizio/__init__.py index 3719ada27ae..b8afba7d69e 100644 --- a/homeassistant/components/vizio/__init__.py +++ b/homeassistant/components/vizio/__init__.py @@ -12,9 +12,10 @@ import voluptuous as vol from homeassistant.components.media_player import DEVICE_CLASS_TV from homeassistant.config_entries import ENTRY_STATE_LOADED, SOURCE_IMPORT, ConfigEntry +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv from homeassistant.helpers.aiohttp_client import async_get_clientsession -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .const import CONF_APPS, CONF_DEVICE_CLASS, DOMAIN, VIZIO_SCHEMA @@ -43,7 +44,7 @@ CONFIG_SCHEMA = vol.Schema( PLATFORMS = ["media_player"] -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Component setup, run import config flow for each entry in config.""" if DOMAIN in config: for entry in config[DOMAIN]: @@ -56,7 +57,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: return True -async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool: +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Load the saved entities.""" hass.data.setdefault(DOMAIN, {}) @@ -76,9 +77,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 a config entry.""" unload_ok = all( await asyncio.gather( @@ -107,7 +106,7 @@ async def async_unload_entry( class VizioAppsDataUpdateCoordinator(DataUpdateCoordinator): """Define an object to hold Vizio app config data.""" - def __init__(self, hass: HomeAssistantType) -> None: + def __init__(self, hass: HomeAssistant) -> None: """Initialize.""" super().__init__( hass, diff --git a/homeassistant/components/vizio/media_player.py b/homeassistant/components/vizio/media_player.py index fc955d48158..57d770b26ae 100644 --- a/homeassistant/components/vizio/media_player.py +++ b/homeassistant/components/vizio/media_player.py @@ -26,7 +26,7 @@ from homeassistant.const import ( STATE_OFF, STATE_ON, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import entity_platform from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.dispatcher import ( @@ -34,7 +34,6 @@ from homeassistant.helpers.dispatcher import ( async_dispatcher_send, ) from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .const import ( @@ -64,7 +63,7 @@ PARALLEL_UPDATES = 0 async def async_setup_entry( - hass: HomeAssistantType, + hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable[[list[Entity], bool], None], ) -> None: @@ -284,7 +283,7 @@ class VizioDevice(MediaPlayerEntity): @staticmethod async def _async_send_update_options_signal( - hass: HomeAssistantType, config_entry: ConfigEntry + hass: HomeAssistant, config_entry: ConfigEntry ) -> None: """Send update event when Vizio config entry is updated.""" # Move this method to component level if another entity ever gets added for a single config entry. diff --git a/tests/components/upnp/test_config_flow.py b/tests/components/upnp/test_config_flow.py index facc5f05701..93f21911c78 100644 --- a/tests/components/upnp/test_config_flow.py +++ b/tests/components/upnp/test_config_flow.py @@ -21,7 +21,7 @@ from homeassistant.components.upnp.const import ( DOMAIN, ) from homeassistant.components.upnp.device import Device -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component from homeassistant.util import dt @@ -30,7 +30,7 @@ from .mock_device import MockDevice from tests.common import MockConfigEntry, async_fire_time_changed -async def test_flow_ssdp_discovery(hass: HomeAssistantType): +async def test_flow_ssdp_discovery(hass: HomeAssistant): """Test config flow: discovered + configured through ssdp.""" udn = "uuid:device_1" location = "dummy" @@ -82,7 +82,7 @@ async def test_flow_ssdp_discovery(hass: HomeAssistantType): } -async def test_flow_ssdp_incomplete_discovery(hass: HomeAssistantType): +async def test_flow_ssdp_incomplete_discovery(hass: HomeAssistant): """Test config flow: incomplete discovery through ssdp.""" udn = "uuid:device_1" location = "dummy" @@ -103,7 +103,7 @@ async def test_flow_ssdp_incomplete_discovery(hass: HomeAssistantType): assert result["reason"] == "incomplete_discovery" -async def test_flow_ssdp_discovery_ignored(hass: HomeAssistantType): +async def test_flow_ssdp_discovery_ignored(hass: HomeAssistant): """Test config flow: discovery through ssdp, but ignored.""" udn = "uuid:device_random_1" location = "dummy" @@ -151,7 +151,7 @@ async def test_flow_ssdp_discovery_ignored(hass: HomeAssistantType): assert result["reason"] == "discovery_ignored" -async def test_flow_user(hass: HomeAssistantType): +async def test_flow_user(hass: HomeAssistant): """Test config flow: discovered + configured through user.""" udn = "uuid:device_1" location = "dummy" @@ -197,7 +197,7 @@ async def test_flow_user(hass: HomeAssistantType): } -async def test_flow_import(hass: HomeAssistantType): +async def test_flow_import(hass: HomeAssistant): """Test config flow: discovered + configured through configuration.yaml.""" udn = "uuid:device_1" mock_device = MockDevice(udn) @@ -235,7 +235,7 @@ async def test_flow_import(hass: HomeAssistantType): } -async def test_flow_import_already_configured(hass: HomeAssistantType): +async def test_flow_import_already_configured(hass: HomeAssistant): """Test config flow: discovered, but already configured.""" udn = "uuid:device_1" mock_device = MockDevice(udn) @@ -261,7 +261,7 @@ async def test_flow_import_already_configured(hass: HomeAssistantType): assert result["reason"] == "already_configured" -async def test_flow_import_incomplete(hass: HomeAssistantType): +async def test_flow_import_incomplete(hass: HomeAssistant): """Test config flow: incomplete discovery, configured through configuration.yaml.""" udn = "uuid:device_1" mock_device = MockDevice(udn) @@ -288,7 +288,7 @@ async def test_flow_import_incomplete(hass: HomeAssistantType): assert result["reason"] == "incomplete_discovery" -async def test_options_flow(hass: HomeAssistantType): +async def test_options_flow(hass: HomeAssistant): """Test options flow.""" # Set up config entry. udn = "uuid:device_1" diff --git a/tests/components/upnp/test_init.py b/tests/components/upnp/test_init.py index 086fbd677ab..e6e37ca52fb 100644 --- a/tests/components/upnp/test_init.py +++ b/tests/components/upnp/test_init.py @@ -15,7 +15,7 @@ from homeassistant.components.upnp.const import ( DOMAIN, ) from homeassistant.components.upnp.device import Device -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component from .mock_device import MockDevice @@ -23,7 +23,7 @@ from .mock_device import MockDevice from tests.common import MockConfigEntry -async def test_async_setup_entry_default(hass: HomeAssistantType): +async def test_async_setup_entry_default(hass: HomeAssistant): """Test async_setup_entry.""" udn = "uuid:device_1" location = "http://192.168.1.1/desc.xml" @@ -69,7 +69,7 @@ async def test_async_setup_entry_default(hass: HomeAssistantType): async_create_device.assert_called_with(hass, discoveries[0][DISCOVERY_LOCATION]) -async def test_sync_setup_entry_multiple_discoveries(hass: HomeAssistantType): +async def test_sync_setup_entry_multiple_discoveries(hass: HomeAssistant): """Test async_setup_entry.""" udn_0 = "uuid:device_1" location_0 = "http://192.168.1.1/desc.xml" diff --git a/tests/components/vizio/test_config_flow.py b/tests/components/vizio/test_config_flow.py index 5f33aa2be4a..544ad2b38cd 100644 --- a/tests/components/vizio/test_config_flow.py +++ b/tests/components/vizio/test_config_flow.py @@ -29,7 +29,7 @@ from homeassistant.const import ( CONF_PIN, CONF_PORT, ) -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from .const import ( ACCESS_TOKEN, @@ -56,7 +56,7 @@ from tests.common import MockConfigEntry async def test_user_flow_minimum_fields( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -80,7 +80,7 @@ async def test_user_flow_minimum_fields( async def test_user_flow_all_fields( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -107,7 +107,7 @@ async def test_user_flow_all_fields( async def test_speaker_options_flow( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -135,7 +135,7 @@ async def test_speaker_options_flow( async def test_tv_options_flow_no_apps( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -166,7 +166,7 @@ async def test_tv_options_flow_no_apps( async def test_tv_options_flow_with_apps( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -198,7 +198,7 @@ async def test_tv_options_flow_with_apps( async def test_tv_options_flow_start_with_volume( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -240,7 +240,7 @@ async def test_tv_options_flow_start_with_volume( async def test_user_host_already_configured( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -264,7 +264,7 @@ async def test_user_host_already_configured( async def test_user_serial_number_already_exists( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -288,7 +288,7 @@ async def test_user_serial_number_already_exists( async def test_user_error_on_could_not_connect( - hass: HomeAssistantType, vizio_no_unique_id: pytest.fixture + hass: HomeAssistant, vizio_no_unique_id: pytest.fixture ) -> None: """Test with could_not_connect during user setup due to no connectivity.""" result = await hass.config_entries.flow.async_init( @@ -300,7 +300,7 @@ async def test_user_error_on_could_not_connect( async def test_user_error_on_could_not_connect_invalid_token( - hass: HomeAssistantType, vizio_cant_connect: pytest.fixture + hass: HomeAssistant, vizio_cant_connect: pytest.fixture ) -> None: """Test with could_not_connect during user setup due to invalid token.""" result = await hass.config_entries.flow.async_init( @@ -312,7 +312,7 @@ async def test_user_error_on_could_not_connect_invalid_token( async def test_user_tv_pairing_no_apps( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_complete_pairing: pytest.fixture, @@ -343,7 +343,7 @@ async def test_user_tv_pairing_no_apps( async def test_user_start_pairing_failure( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_start_pairing_failure: pytest.fixture, @@ -359,7 +359,7 @@ async def test_user_start_pairing_failure( async def test_user_invalid_pin( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_invalid_pin_failure: pytest.fixture, @@ -382,7 +382,7 @@ async def test_user_invalid_pin( async def test_user_ignore( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -402,7 +402,7 @@ async def test_user_ignore( async def test_import_flow_minimum_fields( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -424,7 +424,7 @@ async def test_import_flow_minimum_fields( async def test_import_flow_all_fields( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -445,7 +445,7 @@ async def test_import_flow_all_fields( async def test_import_entity_already_configured( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -467,7 +467,7 @@ async def test_import_entity_already_configured( async def test_import_flow_update_options( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -498,7 +498,7 @@ async def test_import_flow_update_options( async def test_import_flow_update_name_and_apps( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -532,7 +532,7 @@ async def test_import_flow_update_name_and_apps( async def test_import_flow_update_remove_apps( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -565,7 +565,7 @@ async def test_import_flow_update_remove_apps( async def test_import_needs_pairing( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_complete_pairing: pytest.fixture, @@ -602,7 +602,7 @@ async def test_import_needs_pairing( async def test_import_with_apps_needs_pairing( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_complete_pairing: pytest.fixture, @@ -645,7 +645,7 @@ async def test_import_with_apps_needs_pairing( async def test_import_flow_additional_configs( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_update: pytest.fixture, ) -> None: @@ -665,7 +665,7 @@ async def test_import_flow_additional_configs( async def test_import_error( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, caplog: pytest.fixture, @@ -699,7 +699,7 @@ async def test_import_error( async def test_import_ignore( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, ) -> None: @@ -722,7 +722,7 @@ async def test_import_ignore( async def test_zeroconf_flow( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_guess_device_type: pytest.fixture, @@ -753,7 +753,7 @@ async def test_zeroconf_flow( async def test_zeroconf_flow_already_configured( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_guess_device_type: pytest.fixture, @@ -779,7 +779,7 @@ async def test_zeroconf_flow_already_configured( async def test_zeroconf_flow_with_port_in_host( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_guess_device_type: pytest.fixture, @@ -808,7 +808,7 @@ async def test_zeroconf_flow_with_port_in_host( async def test_zeroconf_dupe_fail( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_guess_device_type: pytest.fixture, @@ -834,7 +834,7 @@ async def test_zeroconf_dupe_fail( async def test_zeroconf_ignore( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_guess_device_type: pytest.fixture, @@ -857,7 +857,7 @@ async def test_zeroconf_ignore( async def test_zeroconf_no_unique_id( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_guess_device_type: pytest.fixture, vizio_no_unique_id: pytest.fixture, ) -> None: @@ -873,7 +873,7 @@ async def test_zeroconf_no_unique_id( async def test_zeroconf_abort_when_ignored( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_guess_device_type: pytest.fixture, @@ -898,7 +898,7 @@ async def test_zeroconf_abort_when_ignored( async def test_zeroconf_flow_already_configured_hostname( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_hostname_check: pytest.fixture, @@ -927,7 +927,7 @@ async def test_zeroconf_flow_already_configured_hostname( async def test_import_flow_already_configured_hostname( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_bypass_setup: pytest.fixture, vizio_hostname_check: pytest.fixture, diff --git a/tests/components/vizio/test_init.py b/tests/components/vizio/test_init.py index b223202d5b1..16e2a5bb769 100644 --- a/tests/components/vizio/test_init.py +++ b/tests/components/vizio/test_init.py @@ -4,7 +4,7 @@ import pytest from homeassistant.components.media_player.const import DOMAIN as MP_DOMAIN from homeassistant.components.vizio.const import DOMAIN from homeassistant.const import STATE_UNAVAILABLE -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component from .const import MOCK_SPEAKER_CONFIG, MOCK_USER_VALID_TV_CONFIG, UNIQUE_ID @@ -13,7 +13,7 @@ from tests.common import MockConfigEntry async def test_setup_component( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -26,7 +26,7 @@ async def test_setup_component( async def test_tv_load_and_unload( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -50,7 +50,7 @@ async def test_tv_load_and_unload( async def test_speaker_load_and_unload( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: diff --git a/tests/components/vizio/test_media_player.py b/tests/components/vizio/test_media_player.py index 48a1b5b464f..c137f112976 100644 --- a/tests/components/vizio/test_media_player.py +++ b/tests/components/vizio/test_media_player.py @@ -49,7 +49,7 @@ from homeassistant.components.vizio.const import ( VIZIO_SCHEMA, ) from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON, STATE_UNAVAILABLE -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from homeassistant.util import dt as dt_util from .const import ( @@ -82,7 +82,7 @@ from tests.common import MockConfigEntry, async_fire_time_changed async def _add_config_entry_to_hass( - hass: HomeAssistantType, config_entry: MockConfigEntry + hass: HomeAssistant, config_entry: MockConfigEntry ) -> None: config_entry.add_to_hass(hass) assert await hass.config_entries.async_setup(config_entry.entry_id) @@ -112,7 +112,7 @@ def _assert_sources_and_volume(attr: dict[str, Any], vizio_device_class: str) -> def _get_attr_and_assert_base_attr( - hass: HomeAssistantType, device_class: str, power_state: str + hass: HomeAssistant, device_class: str, power_state: str ) -> dict[str, Any]: """Return entity attributes after asserting name, device class, and power state.""" attr = hass.states.get(ENTITY_ID).attributes @@ -141,9 +141,7 @@ async def _cm_for_test_setup_without_apps( yield -async def _test_setup_tv( - hass: HomeAssistantType, vizio_power_state: bool | None -) -> None: +async def _test_setup_tv(hass: HomeAssistant, vizio_power_state: bool | None) -> None: """Test Vizio TV entity setup.""" ha_power_state = _get_ha_power_state(vizio_power_state) @@ -166,7 +164,7 @@ async def _test_setup_tv( async def _test_setup_speaker( - hass: HomeAssistantType, vizio_power_state: bool | None + hass: HomeAssistant, vizio_power_state: bool | None ) -> None: """Test Vizio Speaker entity setup.""" ha_power_state = _get_ha_power_state(vizio_power_state) @@ -203,7 +201,7 @@ async def _test_setup_speaker( @asynccontextmanager async def _cm_for_test_setup_tv_with_apps( - hass: HomeAssistantType, device_config: dict[str, Any], app_config: dict[str, Any] + hass: HomeAssistant, device_config: dict[str, Any], app_config: dict[str, Any] ) -> None: """Context manager to setup test for Vizio TV with support for apps.""" config_entry = MockConfigEntry( @@ -242,7 +240,7 @@ def _assert_source_list_with_apps( async def _test_service( - hass: HomeAssistantType, + hass: HomeAssistant, domain: str, vizio_func_name: str, ha_service_name: str, @@ -272,7 +270,7 @@ async def _test_service( async def test_speaker_on( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -281,7 +279,7 @@ async def test_speaker_on( async def test_speaker_off( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -290,7 +288,7 @@ async def test_speaker_off( async def test_speaker_unavailable( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -299,7 +297,7 @@ async def test_speaker_unavailable( async def test_init_tv_on( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -308,7 +306,7 @@ async def test_init_tv_on( async def test_init_tv_off( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -317,7 +315,7 @@ async def test_init_tv_off( async def test_init_tv_unavailable( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -326,7 +324,7 @@ async def test_init_tv_unavailable( async def test_setup_unavailable_speaker( - hass: HomeAssistantType, vizio_cant_connect: pytest.fixture + hass: HomeAssistant, vizio_cant_connect: pytest.fixture ) -> None: """Test speaker entity sets up as unavailable.""" config_entry = MockConfigEntry( @@ -338,7 +336,7 @@ async def test_setup_unavailable_speaker( async def test_setup_unavailable_tv( - hass: HomeAssistantType, vizio_cant_connect: pytest.fixture + hass: HomeAssistant, vizio_cant_connect: pytest.fixture ) -> None: """Test TV entity sets up as unavailable.""" config_entry = MockConfigEntry( @@ -350,7 +348,7 @@ async def test_setup_unavailable_tv( async def test_services( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -439,7 +437,7 @@ async def test_services( async def test_options_update( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -461,7 +459,7 @@ async def test_options_update( async def _test_update_availability_switch( - hass: HomeAssistantType, + hass: HomeAssistant, initial_power_state: bool | None, final_power_state: bool | None, caplog: pytest.fixture, @@ -504,7 +502,7 @@ async def _test_update_availability_switch( async def test_update_unavailable_to_available( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, caplog: pytest.fixture, @@ -514,7 +512,7 @@ async def test_update_unavailable_to_available( async def test_update_available_to_unavailable( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, caplog: pytest.fixture, @@ -524,7 +522,7 @@ async def test_update_available_to_unavailable( async def test_setup_with_apps( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, @@ -552,7 +550,7 @@ async def test_setup_with_apps( async def test_setup_with_apps_include( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, @@ -570,7 +568,7 @@ async def test_setup_with_apps_include( async def test_setup_with_apps_exclude( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, @@ -588,7 +586,7 @@ async def test_setup_with_apps_exclude( async def test_setup_with_apps_additional_apps_config( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, @@ -654,7 +652,7 @@ async def test_setup_with_apps_additional_apps_config( assert not service_call2.called -def test_invalid_apps_config(hass: HomeAssistantType): +def test_invalid_apps_config(hass: HomeAssistant): """Test that schema validation fails on certain conditions.""" with raises(vol.Invalid): vol.Schema(vol.All(VIZIO_SCHEMA, validate_apps))(MOCK_TV_APPS_FAILURE) @@ -664,7 +662,7 @@ def test_invalid_apps_config(hass: HomeAssistantType): async def test_setup_with_unknown_app_config( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, @@ -681,7 +679,7 @@ async def test_setup_with_unknown_app_config( async def test_setup_with_no_running_app( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture, @@ -698,7 +696,7 @@ async def test_setup_with_no_running_app( async def test_setup_tv_without_mute( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update: pytest.fixture, ) -> None: @@ -722,7 +720,7 @@ async def test_setup_tv_without_mute( async def test_apps_update( - hass: HomeAssistantType, + hass: HomeAssistant, vizio_connect: pytest.fixture, vizio_update_with_apps: pytest.fixture, caplog: pytest.fixture,