Remove HomeAssistantType alias from entity components - Part 2 (#48468)
parent
855b68faa1
commit
c1d5638739
|
@ -25,7 +25,7 @@ from homeassistant.const import (
|
|||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import CoreState, callback, split_entity_id
|
||||
from homeassistant.core import CoreState, HomeAssistant, callback, split_entity_id
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
|
@ -34,7 +34,6 @@ from homeassistant.helpers.integration_platform import (
|
|||
async_process_integration_platforms,
|
||||
)
|
||||
from homeassistant.helpers.reload import async_reload_integration_platforms
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
|
||||
|
@ -130,7 +129,7 @@ def is_on(hass, entity_id):
|
|||
|
||||
|
||||
@bind_hass
|
||||
def expand_entity_ids(hass: HomeAssistantType, entity_ids: Iterable[Any]) -> list[str]:
|
||||
def expand_entity_ids(hass: HomeAssistant, entity_ids: Iterable[Any]) -> list[str]:
|
||||
"""Return entity_ids with group entity ids replaced by their members.
|
||||
|
||||
Async friendly.
|
||||
|
@ -173,7 +172,7 @@ def expand_entity_ids(hass: HomeAssistantType, entity_ids: Iterable[Any]) -> lis
|
|||
|
||||
@bind_hass
|
||||
def get_entity_ids(
|
||||
hass: HomeAssistantType, entity_id: str, domain_filter: str | None = None
|
||||
hass: HomeAssistant, entity_id: str, domain_filter: str | None = None
|
||||
) -> list[str]:
|
||||
"""Get members of this group.
|
||||
|
||||
|
@ -194,7 +193,7 @@ def get_entity_ids(
|
|||
|
||||
|
||||
@bind_hass
|
||||
def groups_with_entity(hass: HomeAssistantType, entity_id: str) -> list[str]:
|
||||
def groups_with_entity(hass: HomeAssistant, entity_id: str) -> list[str]:
|
||||
"""Get all groups that contain this entity.
|
||||
|
||||
Async friendly.
|
||||
|
|
|
@ -37,10 +37,10 @@ from homeassistant.const import (
|
|||
STATE_ON,
|
||||
STATE_UNAVAILABLE,
|
||||
)
|
||||
from homeassistant.core import CoreState, State
|
||||
from homeassistant.core import CoreState, HomeAssistant, State
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.event import async_track_state_change_event
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import color as color_util
|
||||
|
||||
from . import GroupEntity
|
||||
|
@ -69,7 +69,7 @@ SUPPORT_GROUP_LIGHT = (
|
|||
|
||||
|
||||
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:
|
||||
"""Initialize light.group platform."""
|
||||
async_add_entities(
|
||||
|
|
|
@ -3,15 +3,14 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any, Iterable
|
||||
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from . import get_entity_ids
|
||||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -29,13 +29,12 @@ from homeassistant.const import (
|
|||
CONF_INCLUDE,
|
||||
HTTP_BAD_REQUEST,
|
||||
)
|
||||
from homeassistant.core import Context, State, split_entity_id
|
||||
from homeassistant.core import Context, HomeAssistant, State, split_entity_id
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entityfilter import (
|
||||
CONF_ENTITY_GLOBS,
|
||||
INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA,
|
||||
)
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
@ -673,7 +672,7 @@ def _glob_to_like(glob_str):
|
|||
|
||||
|
||||
def _entities_may_have_state_changes_after(
|
||||
hass: HomeAssistantType, entity_ids: Iterable, start_time: dt
|
||||
hass: HomeAssistant, entity_ids: Iterable, start_time: dt
|
||||
) -> bool:
|
||||
"""Check the state machine to see if entities have changed since start time."""
|
||||
for entity_id in entity_ids:
|
||||
|
|
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
|||
SERVICE_TURN_ON,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||
PLATFORM_SCHEMA,
|
||||
|
@ -22,7 +23,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401
|
|||
)
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
from .const import (
|
||||
|
@ -59,7 +60,7 @@ def is_on(hass, entity_id):
|
|||
return hass.states.is_state(entity_id, STATE_ON)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up humidifier devices."""
|
||||
component = hass.data[DOMAIN] = EntityComponent(
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
|
||||
|
@ -88,12 +89,12 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up a config entry."""
|
||||
return await hass.data[DOMAIN].async_setup_entry(entry)
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
return await hass.data[DOMAIN].async_unload_entry(entry)
|
||||
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
|
||||
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
|
||||
|
||||
|
||||
@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_ON}, STATE_OFF)
|
||||
|
|
|
@ -12,8 +12,7 @@ from homeassistant.const import (
|
|||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
||||
from .const import ATTR_HUMIDITY, DOMAIN, SERVICE_SET_HUMIDITY, SERVICE_SET_MODE
|
||||
|
||||
|
@ -21,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def _async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -81,7 +80,7 @@ async def _async_reproduce_states(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -16,7 +16,7 @@ from homeassistant.const import (
|
|||
SERVICE_TURN_ON,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
|
@ -24,7 +24,7 @@ from homeassistant.helpers.entity_component import EntityComponent
|
|||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
DOMAIN = "input_boolean"
|
||||
|
@ -82,7 +82,7 @@ def is_on(hass, entity_id):
|
|||
return hass.states.is_state(entity_id, STATE_ON)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up an input boolean."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
id_manager = collection.IDManager()
|
||||
|
|
|
@ -12,8 +12,7 @@ from homeassistant.const import (
|
|||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
|
@ -21,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def _async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -55,7 +54,7 @@ async def _async_reproduce_states(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -15,14 +15,14 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -101,7 +101,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
RELOAD_SERVICE_SCHEMA = vol.Schema({})
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up an input datetime."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
id_manager = collection.IDManager()
|
||||
|
|
|
@ -6,8 +6,7 @@ import logging
|
|||
from typing import Any, Iterable
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import ATTR_DATE, ATTR_DATETIME, ATTR_TIME, CONF_HAS_DATE, CONF_HAS_TIME, DOMAIN
|
||||
|
@ -34,7 +33,7 @@ def is_valid_time(string: str) -> bool:
|
|||
|
||||
|
||||
async def _async_reproduce_state(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -79,7 +78,7 @@ async def _async_reproduce_state(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -15,14 +15,14 @@ from homeassistant.const import (
|
|||
CONF_UNIT_OF_MEASUREMENT,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -112,7 +112,7 @@ STORAGE_KEY = DOMAIN
|
|||
STORAGE_VERSION = 1
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up an input slider."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
id_manager = collection.IDManager()
|
||||
|
|
|
@ -8,8 +8,7 @@ from typing import Any, Iterable
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
||||
from . import ATTR_VALUE, DOMAIN, SERVICE_SET_VALUE
|
||||
|
||||
|
@ -17,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def _async_reproduce_state(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -55,7 +54,7 @@ async def _async_reproduce_state(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -13,14 +13,14 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -87,7 +87,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
RELOAD_SERVICE_SCHEMA = vol.Schema({})
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up an input select."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
id_manager = collection.IDManager()
|
||||
|
|
|
@ -7,8 +7,7 @@ from types import MappingProxyType
|
|||
from typing import Any, Iterable
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
||||
from . import (
|
||||
ATTR_OPTION,
|
||||
|
@ -24,7 +23,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def _async_reproduce_state(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -70,7 +69,7 @@ async def _async_reproduce_state(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -15,14 +15,14 @@ from homeassistant.const import (
|
|||
CONF_UNIT_OF_MEASUREMENT,
|
||||
SERVICE_RELOAD,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import collection
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.helpers.service
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceCallType
|
||||
from homeassistant.helpers.typing import ConfigType, ServiceCallType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -112,7 +112,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
RELOAD_SERVICE_SCHEMA = vol.Schema({})
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up an input text."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
id_manager = collection.IDManager()
|
||||
|
|
|
@ -6,8 +6,7 @@ import logging
|
|||
from typing import Any, Iterable
|
||||
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
||||
from . import ATTR_VALUE, DOMAIN, SERVICE_SET_VALUE
|
||||
|
||||
|
@ -15,7 +14,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
|
||||
async def _async_reproduce_state(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -43,7 +42,7 @@ async def _async_reproduce_state(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -16,7 +16,7 @@ from homeassistant.const import (
|
|||
SERVICE_TURN_ON,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||
PLATFORM_SCHEMA,
|
||||
|
@ -25,7 +25,6 @@ from homeassistant.helpers.config_validation import ( # noqa: F401
|
|||
)
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.loader import bind_hass
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
|
@ -411,7 +410,7 @@ class Profile:
|
|||
class Profiles:
|
||||
"""Representation of available color profiles."""
|
||||
|
||||
def __init__(self, hass: HomeAssistantType):
|
||||
def __init__(self, hass: HomeAssistant):
|
||||
"""Initialize profiles."""
|
||||
self.hass = hass
|
||||
self.data: dict[str, Profile] = {}
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
|
||||
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
|
||||
|
||||
|
||||
@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_ON}, STATE_OFF)
|
||||
|
|
|
@ -13,8 +13,7 @@ from homeassistant.const import (
|
|||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
||||
from . import (
|
||||
ATTR_BRIGHTNESS,
|
||||
|
@ -94,7 +93,7 @@ DEPRECATION_WARNING = (
|
|||
|
||||
|
||||
async def _async_reproduce_state(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -170,7 +169,7 @@ async def _async_reproduce_state(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -4,8 +4,9 @@ import functools
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import light
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .. import DOMAIN, PLATFORMS
|
||||
from ..mixins import async_setup_entry_helper
|
||||
|
@ -31,7 +32,7 @@ PLATFORM_SCHEMA = vol.All(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
||||
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||
):
|
||||
"""Set up MQTT light through configuration.yaml."""
|
||||
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
|
||||
|
|
|
@ -10,12 +10,11 @@ import voluptuous as vol
|
|||
|
||||
import homeassistant.components.persistent_notification as pn
|
||||
from homeassistant.const import CONF_NAME, CONF_PLATFORM
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import config_per_platform, discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.service import async_set_service_schema
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.loader import async_get_integration, bind_hass
|
||||
from homeassistant.setup import async_prepare_setup_platform
|
||||
from homeassistant.util import slugify
|
||||
|
@ -71,7 +70,7 @@ PERSISTENT_NOTIFICATION_SERVICE_SCHEMA = vol.Schema(
|
|||
|
||||
|
||||
@bind_hass
|
||||
async def async_reload(hass: HomeAssistantType, integration_name: str) -> None:
|
||||
async def async_reload(hass: HomeAssistant, integration_name: str) -> None:
|
||||
"""Register notify services for an integration."""
|
||||
if not _async_integration_has_notify_services(hass, integration_name):
|
||||
return
|
||||
|
@ -85,7 +84,7 @@ async def async_reload(hass: HomeAssistantType, integration_name: str) -> None:
|
|||
|
||||
|
||||
@bind_hass
|
||||
async def async_reset_platform(hass: HomeAssistantType, integration_name: str) -> None:
|
||||
async def async_reset_platform(hass: HomeAssistant, integration_name: str) -> None:
|
||||
"""Unregister notify services for an integration."""
|
||||
if not _async_integration_has_notify_services(hass, integration_name):
|
||||
return
|
||||
|
@ -101,7 +100,7 @@ async def async_reset_platform(hass: HomeAssistantType, integration_name: str) -
|
|||
|
||||
|
||||
def _async_integration_has_notify_services(
|
||||
hass: HomeAssistantType, integration_name: str
|
||||
hass: HomeAssistant, integration_name: str
|
||||
) -> bool:
|
||||
"""Determine if an integration has notify services registered."""
|
||||
if (
|
||||
|
@ -119,7 +118,7 @@ class BaseNotificationService:
|
|||
# While not purely typed, it makes typehinting more useful for us
|
||||
# and removes the need for constant None checks or asserts.
|
||||
# Ignore types: https://github.com/PyCQA/pylint/issues/3167
|
||||
hass: HomeAssistantType = None # type: ignore
|
||||
hass: HomeAssistant = None # type: ignore
|
||||
|
||||
# Name => target
|
||||
registered_targets: dict[str, str]
|
||||
|
@ -163,7 +162,7 @@ class BaseNotificationService:
|
|||
|
||||
async def async_setup(
|
||||
self,
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
service_name: str,
|
||||
target_service_name_prefix: str,
|
||||
) -> None:
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
|
||||
from homeassistant.components.group import GroupIntegrationRegistry
|
||||
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.exclude_domain()
|
||||
|
|
|
@ -3,13 +3,12 @@
|
|||
|
||||
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
|
||||
|
||||
|
||||
@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_ON}, STATE_OFF)
|
||||
|
|
|
@ -14,15 +14,11 @@ from homeassistant.const import (
|
|||
STATE_ON,
|
||||
STATE_UNAVAILABLE,
|
||||
)
|
||||
from homeassistant.core import State, callback
|
||||
from homeassistant.core import HomeAssistant, State, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_state_change_event
|
||||
from homeassistant.helpers.typing import (
|
||||
ConfigType,
|
||||
DiscoveryInfoType,
|
||||
HomeAssistantType,
|
||||
)
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
|
@ -37,7 +33,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: Callable[[Sequence[Entity]], None],
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
|
|
|
@ -12,8 +12,7 @@ from homeassistant.const import (
|
|||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.core import Context, HomeAssistant, State
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
|
@ -23,7 +22,7 @@ VALID_STATES = {STATE_ON, STATE_OFF}
|
|||
|
||||
|
||||
async def _async_reproduce_state(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
state: State,
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
@ -59,7 +58,7 @@ async def _async_reproduce_state(
|
|||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType,
|
||||
hass: HomeAssistant,
|
||||
states: Iterable[State],
|
||||
*,
|
||||
context: Context | None = None,
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
|
||||
from homeassistant.components.group import GroupIntegrationRegistry
|
||||
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.exclude_domain()
|
||||
|
|
Loading…
Reference in New Issue