mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Rename HomeAssistantType to HomeAssistant, integrations w* - z* (#49543)
* Integration zha: HomeAssistantType -> HomeAssistant. * Integration zerproc: HomeAssistantType -> HomeAssistant. * Integration xbox: HomeAssistantType -> HomeAssistant. * Integration wunderground: HomeAssistantType -> HomeAssistant. * Integration wled: HomeAssistantType -> HomeAssistant. * Integration water_heater: HomeAssistantType -> HomeAssistant. * Integration websocket_api: HomeAssistantType -> HomeAssistant. * Integration wilight: HomeAssistantType -> HomeAssistant.
This commit is contained in:
parent
6992e24263
commit
9879b7becf
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
from homeassistant.components.group import GroupIntegrationRegistry
|
from homeassistant.components.group import GroupIntegrationRegistry
|
||||||
from homeassistant.const import STATE_OFF
|
from homeassistant.const import STATE_OFF
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
STATE_ECO,
|
STATE_ECO,
|
||||||
@ -18,7 +17,7 @@ from . import (
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_describe_on_off_states(
|
def async_describe_on_off_states(
|
||||||
hass: HomeAssistantType, registry: GroupIntegrationRegistry
|
hass: HomeAssistant, registry: GroupIntegrationRegistry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Describe group on off states."""
|
"""Describe group on off states."""
|
||||||
registry.on_off_states(
|
registry.on_off_states(
|
||||||
|
@ -13,8 +13,7 @@ from homeassistant.const import (
|
|||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.core import Context, State
|
from homeassistant.core import Context, HomeAssistant, State
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
ATTR_AWAY_MODE,
|
ATTR_AWAY_MODE,
|
||||||
@ -47,7 +46,7 @@ VALID_STATES = {
|
|||||||
|
|
||||||
|
|
||||||
async def _async_reproduce_state(
|
async def _async_reproduce_state(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
state: State,
|
state: State,
|
||||||
*,
|
*,
|
||||||
context: Context | None = None,
|
context: Context | None = None,
|
||||||
@ -124,7 +123,7 @@ async def _async_reproduce_state(
|
|||||||
|
|
||||||
|
|
||||||
async def async_reproduce_states(
|
async def async_reproduce_states(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
states: Iterable[State],
|
states: Iterable[State],
|
||||||
*,
|
*,
|
||||||
context: Context | None = None,
|
context: Context | None = None,
|
||||||
|
@ -22,13 +22,12 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.entity_registry import (
|
from homeassistant.helpers.entity_registry import (
|
||||||
async_get_registry as async_get_entity_registry,
|
async_get_registry as async_get_entity_registry,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from . import WLEDDataUpdateCoordinator, WLEDDeviceEntity, wled_exception_handler
|
from . import WLEDDataUpdateCoordinator, WLEDDeviceEntity, wled_exception_handler
|
||||||
@ -51,7 +50,7 @@ PARALLEL_UPDATES = 1
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
entry: ConfigEntry,
|
entry: ConfigEntry,
|
||||||
async_add_entities: Callable[[list[Entity], bool], None],
|
async_add_entities: Callable[[list[Entity], bool], None],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -13,8 +13,8 @@ from homeassistant.const import (
|
|||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
from . import WLEDDataUpdateCoordinator, WLEDDeviceEntity
|
from . import WLEDDataUpdateCoordinator, WLEDDeviceEntity
|
||||||
@ -22,7 +22,7 @@ from .const import ATTR_LED_COUNT, ATTR_MAX_POWER, CURRENT_MA, DOMAIN
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
entry: ConfigEntry,
|
entry: ConfigEntry,
|
||||||
async_add_entities: Callable[[list[Entity], bool], None],
|
async_add_entities: Callable[[list[Entity], bool], None],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -5,8 +5,8 @@ from typing import Any, Callable
|
|||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import WLEDDataUpdateCoordinator, WLEDDeviceEntity, wled_exception_handler
|
from . import WLEDDataUpdateCoordinator, WLEDDeviceEntity, wled_exception_handler
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -21,7 +21,7 @@ PARALLEL_UPDATES = 1
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
entry: ConfigEntry,
|
entry: ConfigEntry,
|
||||||
async_add_entities: Callable[[list[Entity], bool], None],
|
async_add_entities: Callable[[list[Entity], bool], None],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -33,10 +33,11 @@ from homeassistant.const import (
|
|||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_RESOURCE = "http://api.wunderground.com/api/{}/{}/{}/q/"
|
_RESOURCE = "http://api.wunderground.com/api/{}/{}/{}/q/"
|
||||||
@ -1084,7 +1085,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
|
hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None
|
||||||
):
|
):
|
||||||
"""Set up the WUnderground sensor."""
|
"""Set up the WUnderground sensor."""
|
||||||
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
|
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
|
||||||
@ -1119,7 +1120,7 @@ async def async_setup_platform(
|
|||||||
class WUndergroundSensor(SensorEntity):
|
class WUndergroundSensor(SensorEntity):
|
||||||
"""Implementing the WUnderground sensor."""
|
"""Implementing the WUnderground sensor."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistantType, rest, condition, unique_id_base: str):
|
def __init__(self, hass: HomeAssistant, rest, condition, unique_id_base: str):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
self.rest = rest
|
self.rest = rest
|
||||||
self._condition = condition
|
self._condition = condition
|
||||||
|
@ -29,7 +29,6 @@ from homeassistant.helpers import (
|
|||||||
config_entry_oauth2_flow,
|
config_entry_oauth2_flow,
|
||||||
config_validation as cv,
|
config_validation as cv,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
|
|
||||||
from . import api, config_flow
|
from . import api, config_flow
|
||||||
@ -168,7 +167,7 @@ class XboxUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
client: XboxLiveClient,
|
client: XboxLiveClient,
|
||||||
consoles: SmartglassConsoleList,
|
consoles: SmartglassConsoleList,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -4,11 +4,10 @@ from __future__ import annotations
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_registry import (
|
from homeassistant.helpers.entity_registry import (
|
||||||
async_get_registry as async_get_entity_registry,
|
async_get_registry as async_get_entity_registry,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import XboxUpdateCoordinator
|
from . import XboxUpdateCoordinator
|
||||||
from .base_sensor import XboxBaseSensorEntity
|
from .base_sensor import XboxBaseSensorEntity
|
||||||
@ -17,7 +16,7 @@ from .const import DOMAIN
|
|||||||
PRESENCE_ATTRIBUTES = ["online", "in_party", "in_game", "in_multiplayer"]
|
PRESENCE_ATTRIBUTES = ["online", "in_party", "in_game", "in_multiplayer"]
|
||||||
|
|
||||||
|
|
||||||
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 Xbox Live friends."""
|
"""Set up Xbox Live friends."""
|
||||||
coordinator: XboxUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id][
|
coordinator: XboxUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id][
|
||||||
"coordinator"
|
"coordinator"
|
||||||
|
@ -24,8 +24,7 @@ from homeassistant.components.media_source.models import (
|
|||||||
MediaSourceItem,
|
MediaSourceItem,
|
||||||
PlayMedia,
|
PlayMedia,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from .browse_media import _find_media_image
|
from .browse_media import _find_media_image
|
||||||
@ -42,7 +41,7 @@ MEDIA_CLASS_MAP = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def async_get_media_source(hass: HomeAssistantType):
|
async def async_get_media_source(hass: HomeAssistant):
|
||||||
"""Set up Xbox media source."""
|
"""Set up Xbox media source."""
|
||||||
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
entry = hass.config_entries.async_entries(DOMAIN)[0]
|
||||||
client = hass.data[DOMAIN][entry.entry_id]["client"]
|
client = hass.data[DOMAIN][entry.entry_id]["client"]
|
||||||
@ -75,11 +74,11 @@ class XboxSource(MediaSource):
|
|||||||
|
|
||||||
name: str = "Xbox Game Media"
|
name: str = "Xbox Game Media"
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistantType, client: XboxLiveClient):
|
def __init__(self, hass: HomeAssistant, client: XboxLiveClient):
|
||||||
"""Initialize Xbox source."""
|
"""Initialize Xbox source."""
|
||||||
super().__init__(DOMAIN)
|
super().__init__(DOMAIN)
|
||||||
|
|
||||||
self.hass: HomeAssistantType = hass
|
self.hass: HomeAssistant = hass
|
||||||
self.client: XboxLiveClient = client
|
self.client: XboxLiveClient = client
|
||||||
|
|
||||||
async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia:
|
async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia:
|
||||||
|
@ -4,11 +4,10 @@ from __future__ import annotations
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_registry import (
|
from homeassistant.helpers.entity_registry import (
|
||||||
async_get_registry as async_get_entity_registry,
|
async_get_registry as async_get_entity_registry,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import XboxUpdateCoordinator
|
from . import XboxUpdateCoordinator
|
||||||
from .base_sensor import XboxBaseSensorEntity
|
from .base_sensor import XboxBaseSensorEntity
|
||||||
@ -17,7 +16,7 @@ from .const import DOMAIN
|
|||||||
SENSOR_ATTRIBUTES = ["status", "gamer_score", "account_tier", "gold_tenure"]
|
SENSOR_ATTRIBUTES = ["status", "gamer_score", "account_tier", "gold_tenure"]
|
||||||
|
|
||||||
|
|
||||||
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 Xbox Live friends."""
|
"""Set up Xbox Live friends."""
|
||||||
coordinator: XboxUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id][
|
coordinator: XboxUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id][
|
||||||
"coordinator"
|
"coordinator"
|
||||||
|
@ -19,7 +19,6 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
|
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
|
||||||
@ -51,7 +50,7 @@ async def discover_entities(hass: HomeAssistant) -> list[Entity]:
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities: Callable[[list[Entity], bool], None],
|
async_add_entities: Callable[[list[Entity], bool], None],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -8,10 +8,10 @@ from zhaquirks import setup as setup_quirks
|
|||||||
from zigpy.config import CONF_DEVICE, CONF_DEVICE_PATH
|
from zigpy.config import CONF_DEVICE, CONF_DEVICE_PATH
|
||||||
|
|
||||||
from homeassistant import config_entries, const as ha_const
|
from homeassistant import config_entries, const as ha_const
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import api
|
from . import api
|
||||||
from .core import ZHAGateway
|
from .core import ZHAGateway
|
||||||
@ -156,7 +156,7 @@ async def async_unload_entry(hass, config_entry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_load_entities(hass: HomeAssistantType) -> None:
|
async def async_load_entities(hass: HomeAssistant) -> None:
|
||||||
"""Load entities after integration was setup."""
|
"""Load entities after integration was setup."""
|
||||||
await hass.data[DATA_ZHA][DATA_ZHA_GATEWAY].async_initialize_devices_and_entities()
|
await hass.data[DATA_ZHA][DATA_ZHA_GATEWAY].async_initialize_devices_and_entities()
|
||||||
to_setup = hass.data[DATA_ZHA][DATA_ZHA_PLATFORM_LOADED]
|
to_setup = hass.data[DATA_ZHA][DATA_ZHA_PLATFORM_LOADED]
|
||||||
@ -168,7 +168,7 @@ async def async_load_entities(hass: HomeAssistantType) -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def async_migrate_entry(
|
async def async_migrate_entry(
|
||||||
hass: HomeAssistantType, config_entry: config_entries.ConfigEntry
|
hass: HomeAssistant, config_entry: config_entries.ConfigEntry
|
||||||
):
|
):
|
||||||
"""Migrate old entry."""
|
"""Migrate old entry."""
|
||||||
_LOGGER.debug("Migrating from version %s", config_entry.version)
|
_LOGGER.debug("Migrating from version %s", config_entry.version)
|
||||||
|
@ -17,13 +17,12 @@ from zigpy.zcl.clusters.general import Groups
|
|||||||
import zigpy.zdo.types as zdo_types
|
import zigpy.zdo.types as zdo_types
|
||||||
|
|
||||||
from homeassistant.const import ATTR_COMMAND, ATTR_NAME
|
from homeassistant.const import ATTR_COMMAND, ATTR_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import (
|
from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import channels, typing as zha_typing
|
from . import channels, typing as zha_typing
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -88,7 +87,7 @@ class ZHADevice(LogMixin):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
zigpy_device: zha_typing.ZigpyDeviceType,
|
zigpy_device: zha_typing.ZigpyDeviceType,
|
||||||
zha_gateway: zha_typing.ZhaGatewayType,
|
zha_gateway: zha_typing.ZhaGatewayType,
|
||||||
):
|
):
|
||||||
@ -288,7 +287,7 @@ class ZHADevice(LogMixin):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def new(
|
def new(
|
||||||
cls,
|
cls,
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
zigpy_dev: zha_typing.ZigpyDeviceType,
|
zigpy_dev: zha_typing.ZigpyDeviceType,
|
||||||
gateway: zha_typing.ZhaGatewayType,
|
gateway: zha_typing.ZhaGatewayType,
|
||||||
restored: bool = False,
|
restored: bool = False,
|
||||||
|
@ -6,13 +6,12 @@ import logging
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from homeassistant import const as ha_const
|
from homeassistant import const as ha_const
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import (
|
from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity_registry import async_entries_for_device
|
from homeassistant.helpers.entity_registry import async_entries_for_device
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import const as zha_const, registries as zha_regs, typing as zha_typing
|
from . import const as zha_const, registries as zha_regs, typing as zha_typing
|
||||||
from .. import ( # noqa: F401 pylint: disable=unused-import,
|
from .. import ( # noqa: F401 pylint: disable=unused-import,
|
||||||
@ -159,7 +158,7 @@ class ProbeEndpoint:
|
|||||||
channel = channel_class(cluster, ep_channels)
|
channel = channel_class(cluster, ep_channels)
|
||||||
self.probe_single_cluster(component, channel, ep_channels)
|
self.probe_single_cluster(component, channel, ep_channels)
|
||||||
|
|
||||||
def initialize(self, hass: HomeAssistantType) -> None:
|
def initialize(self, hass: HomeAssistant) -> None:
|
||||||
"""Update device overrides config."""
|
"""Update device overrides config."""
|
||||||
zha_config = hass.data[zha_const.DATA_ZHA].get(zha_const.DATA_ZHA_CONFIG, {})
|
zha_config = hass.data[zha_const.DATA_ZHA].get(zha_const.DATA_ZHA_CONFIG, {})
|
||||||
overrides = zha_config.get(zha_const.CONF_DEVICE_CONFIG)
|
overrides = zha_config.get(zha_const.CONF_DEVICE_CONFIG)
|
||||||
@ -175,7 +174,7 @@ class GroupProbe:
|
|||||||
self._hass = None
|
self._hass = None
|
||||||
self._unsubs = []
|
self._unsubs = []
|
||||||
|
|
||||||
def initialize(self, hass: HomeAssistantType) -> None:
|
def initialize(self, hass: HomeAssistant) -> None:
|
||||||
"""Initialize the group probe."""
|
"""Initialize the group probe."""
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
self._unsubs.append(
|
self._unsubs.append(
|
||||||
@ -235,7 +234,7 @@ class GroupProbe:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def determine_entity_domains(
|
def determine_entity_domains(
|
||||||
hass: HomeAssistantType, group: zha_typing.ZhaGroupType
|
hass: HomeAssistant, group: zha_typing.ZhaGroupType
|
||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
"""Determine the entity domains for this group."""
|
"""Determine the entity domains for this group."""
|
||||||
entity_domains: list[str] = []
|
entity_domains: list[str] = []
|
||||||
|
@ -8,8 +8,8 @@ from typing import Any
|
|||||||
|
|
||||||
import zigpy.exceptions
|
import zigpy.exceptions
|
||||||
|
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_registry import async_entries_for_device
|
from homeassistant.helpers.entity_registry import async_entries_for_device
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .helpers import LogMixin
|
from .helpers import LogMixin
|
||||||
from .typing import (
|
from .typing import (
|
||||||
@ -113,12 +113,12 @@ class ZHAGroup(LogMixin):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
zha_gateway: ZhaGatewayType,
|
zha_gateway: ZhaGatewayType,
|
||||||
zigpy_group: ZigpyGroupType,
|
zigpy_group: ZigpyGroupType,
|
||||||
):
|
):
|
||||||
"""Initialize the group."""
|
"""Initialize the group."""
|
||||||
self.hass: HomeAssistantType = hass
|
self.hass: HomeAssistant = hass
|
||||||
self._zigpy_group: ZigpyGroupType = zigpy_group
|
self._zigpy_group: ZigpyGroupType = zigpy_group
|
||||||
self._zha_gateway: ZhaGatewayType = zha_gateway
|
self._zha_gateway: ZhaGatewayType = zha_gateway
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ from homeassistant.const import (
|
|||||||
PRESSURE_HPA,
|
PRESSURE_HPA,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.typing import HomeAssistantType, StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
|
|
||||||
from .core import discovery
|
from .core import discovery
|
||||||
from .core.const import (
|
from .core.const import (
|
||||||
@ -72,7 +72,7 @@ STRICT_MATCH = functools.partial(ZHA_ENTITIES.strict_match, DOMAIN)
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities: Callable
|
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the Zigbee Home Automation sensor from config entry."""
|
"""Set up the Zigbee Home Automation sensor from config entry."""
|
||||||
entities_to_create = hass.data[DATA_ZHA][DOMAIN]
|
entities_to_create = hass.data[DATA_ZHA][DOMAIN]
|
||||||
|
@ -14,11 +14,10 @@ from homeassistant.components.websocket_api.auth import (
|
|||||||
TYPE_AUTH_REQUIRED,
|
TYPE_AUTH_REQUIRED,
|
||||||
)
|
)
|
||||||
from homeassistant.components.websocket_api.const import URL
|
from homeassistant.components.websocket_api.const import URL
|
||||||
from homeassistant.core import Context, callback
|
from homeassistant.core import Context, HomeAssistant, callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import entity
|
from homeassistant.helpers import entity
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.loader import async_get_integration
|
from homeassistant.loader import async_get_integration
|
||||||
from homeassistant.setup import DATA_SETUP_TIME, async_setup_component
|
from homeassistant.setup import DATA_SETUP_TIME, async_setup_component
|
||||||
|
|
||||||
@ -233,7 +232,7 @@ async def test_call_service_child_not_found(hass, websocket_client):
|
|||||||
|
|
||||||
|
|
||||||
async def test_call_service_schema_validation_error(
|
async def test_call_service_schema_validation_error(
|
||||||
hass: HomeAssistantType, websocket_client
|
hass: HomeAssistant, websocket_client
|
||||||
):
|
):
|
||||||
"""Test call service command with invalid service data."""
|
"""Test call service command with invalid service data."""
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant.components.wilight.config_flow import (
|
|||||||
CONF_SERIAL_NUMBER,
|
CONF_SERIAL_NUMBER,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ MOCK_SSDP_DISCOVERY_INFO_MISSING_MANUFACTORER = {
|
|||||||
|
|
||||||
|
|
||||||
async def setup_integration(
|
async def setup_integration(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
) -> MockConfigEntry:
|
) -> MockConfigEntry:
|
||||||
"""Mock ConfigEntry in Home Assistant."""
|
"""Mock ConfigEntry in Home Assistant."""
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@ from homeassistant.components.wilight.config_flow import (
|
|||||||
)
|
)
|
||||||
from homeassistant.config_entries import SOURCE_SSDP
|
from homeassistant.config_entries import SOURCE_SSDP
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SOURCE
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SOURCE
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.data_entry_flow import (
|
from homeassistant.data_entry_flow import (
|
||||||
RESULT_TYPE_ABORT,
|
RESULT_TYPE_ABORT,
|
||||||
RESULT_TYPE_CREATE_ENTRY,
|
RESULT_TYPE_CREATE_ENTRY,
|
||||||
RESULT_TYPE_FORM,
|
RESULT_TYPE_FORM,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
from tests.components.wilight import (
|
from tests.components.wilight import (
|
||||||
@ -52,7 +52,7 @@ def mock_dummy_get_components_from_model_wrong():
|
|||||||
yield components
|
yield components
|
||||||
|
|
||||||
|
|
||||||
async def test_show_ssdp_form(hass: HomeAssistantType) -> None:
|
async def test_show_ssdp_form(hass: HomeAssistant) -> None:
|
||||||
"""Test that the ssdp confirmation form is served."""
|
"""Test that the ssdp confirmation form is served."""
|
||||||
|
|
||||||
discovery_info = MOCK_SSDP_DISCOVERY_INFO_P_B.copy()
|
discovery_info = MOCK_SSDP_DISCOVERY_INFO_P_B.copy()
|
||||||
@ -68,7 +68,7 @@ async def test_show_ssdp_form(hass: HomeAssistantType) -> None:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def test_ssdp_not_wilight_abort_1(hass: HomeAssistantType) -> None:
|
async def test_ssdp_not_wilight_abort_1(hass: HomeAssistant) -> None:
|
||||||
"""Test that the ssdp aborts not_wilight."""
|
"""Test that the ssdp aborts not_wilight."""
|
||||||
|
|
||||||
discovery_info = MOCK_SSDP_DISCOVERY_INFO_WRONG_MANUFACTORER.copy()
|
discovery_info = MOCK_SSDP_DISCOVERY_INFO_WRONG_MANUFACTORER.copy()
|
||||||
@ -80,7 +80,7 @@ async def test_ssdp_not_wilight_abort_1(hass: HomeAssistantType) -> None:
|
|||||||
assert result["reason"] == "not_wilight_device"
|
assert result["reason"] == "not_wilight_device"
|
||||||
|
|
||||||
|
|
||||||
async def test_ssdp_not_wilight_abort_2(hass: HomeAssistantType) -> None:
|
async def test_ssdp_not_wilight_abort_2(hass: HomeAssistant) -> None:
|
||||||
"""Test that the ssdp aborts not_wilight."""
|
"""Test that the ssdp aborts not_wilight."""
|
||||||
|
|
||||||
discovery_info = MOCK_SSDP_DISCOVERY_INFO_MISSING_MANUFACTORER.copy()
|
discovery_info = MOCK_SSDP_DISCOVERY_INFO_MISSING_MANUFACTORER.copy()
|
||||||
@ -93,7 +93,7 @@ async def test_ssdp_not_wilight_abort_2(hass: HomeAssistantType) -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def test_ssdp_not_wilight_abort_3(
|
async def test_ssdp_not_wilight_abort_3(
|
||||||
hass: HomeAssistantType, dummy_get_components_from_model_clear
|
hass: HomeAssistant, dummy_get_components_from_model_clear
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the ssdp aborts not_wilight."""
|
"""Test that the ssdp aborts not_wilight."""
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ async def test_ssdp_not_wilight_abort_3(
|
|||||||
|
|
||||||
|
|
||||||
async def test_ssdp_not_supported_abort(
|
async def test_ssdp_not_supported_abort(
|
||||||
hass: HomeAssistantType, dummy_get_components_from_model_wrong
|
hass: HomeAssistant, dummy_get_components_from_model_wrong
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the ssdp aborts not_supported."""
|
"""Test that the ssdp aborts not_supported."""
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ async def test_ssdp_not_supported_abort(
|
|||||||
assert result["reason"] == "not_supported_device"
|
assert result["reason"] == "not_supported_device"
|
||||||
|
|
||||||
|
|
||||||
async def test_ssdp_device_exists_abort(hass: HomeAssistantType) -> None:
|
async def test_ssdp_device_exists_abort(hass: HomeAssistant) -> None:
|
||||||
"""Test abort SSDP flow if WiLight already configured."""
|
"""Test abort SSDP flow if WiLight already configured."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
@ -145,7 +145,7 @@ async def test_ssdp_device_exists_abort(hass: HomeAssistantType) -> None:
|
|||||||
assert result["reason"] == "already_configured"
|
assert result["reason"] == "already_configured"
|
||||||
|
|
||||||
|
|
||||||
async def test_full_ssdp_flow_implementation(hass: HomeAssistantType) -> None:
|
async def test_full_ssdp_flow_implementation(hass: HomeAssistant) -> None:
|
||||||
"""Test the full SSDP flow from start to finish."""
|
"""Test the full SSDP flow from start to finish."""
|
||||||
|
|
||||||
discovery_info = MOCK_SSDP_DISCOVERY_INFO_P_B.copy()
|
discovery_info = MOCK_SSDP_DISCOVERY_INFO_P_B.copy()
|
||||||
|
@ -20,8 +20,8 @@ from homeassistant.const import (
|
|||||||
STATE_OPEN,
|
STATE_OPEN,
|
||||||
STATE_OPENING,
|
STATE_OPENING,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
HOST,
|
HOST,
|
||||||
@ -56,7 +56,7 @@ def mock_dummy_device_from_host_light_fan():
|
|||||||
|
|
||||||
|
|
||||||
async def test_loading_cover(
|
async def test_loading_cover(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
dummy_device_from_host_cover,
|
dummy_device_from_host_cover,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the WiLight configuration entry loading."""
|
"""Test the WiLight configuration entry loading."""
|
||||||
@ -78,7 +78,7 @@ async def test_loading_cover(
|
|||||||
|
|
||||||
|
|
||||||
async def test_open_close_cover_state(
|
async def test_open_close_cover_state(
|
||||||
hass: HomeAssistantType, dummy_device_from_host_cover
|
hass: HomeAssistant, dummy_device_from_host_cover
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the change of state of the cover."""
|
"""Test the change of state of the cover."""
|
||||||
await setup_integration(hass)
|
await setup_integration(hass)
|
||||||
|
@ -20,8 +20,8 @@ from homeassistant.const import (
|
|||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
HOST,
|
HOST,
|
||||||
@ -56,7 +56,7 @@ def mock_dummy_device_from_host_light_fan():
|
|||||||
|
|
||||||
|
|
||||||
async def test_loading_light_fan(
|
async def test_loading_light_fan(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
dummy_device_from_host_light_fan,
|
dummy_device_from_host_light_fan,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the WiLight configuration entry loading."""
|
"""Test the WiLight configuration entry loading."""
|
||||||
@ -78,7 +78,7 @@ async def test_loading_light_fan(
|
|||||||
|
|
||||||
|
|
||||||
async def test_on_off_fan_state(
|
async def test_on_off_fan_state(
|
||||||
hass: HomeAssistantType, dummy_device_from_host_light_fan
|
hass: HomeAssistant, dummy_device_from_host_light_fan
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the change of state of the fan switches."""
|
"""Test the change of state of the fan switches."""
|
||||||
await setup_integration(hass)
|
await setup_integration(hass)
|
||||||
@ -125,7 +125,7 @@ async def test_on_off_fan_state(
|
|||||||
|
|
||||||
|
|
||||||
async def test_speed_fan_state(
|
async def test_speed_fan_state(
|
||||||
hass: HomeAssistantType, dummy_device_from_host_light_fan
|
hass: HomeAssistant, dummy_device_from_host_light_fan
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the change of speed of the fan switches."""
|
"""Test the change of speed of the fan switches."""
|
||||||
await setup_integration(hass)
|
await setup_integration(hass)
|
||||||
@ -171,7 +171,7 @@ async def test_speed_fan_state(
|
|||||||
|
|
||||||
|
|
||||||
async def test_direction_fan_state(
|
async def test_direction_fan_state(
|
||||||
hass: HomeAssistantType, dummy_device_from_host_light_fan
|
hass: HomeAssistant, dummy_device_from_host_light_fan
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the change of direction of the fan switches."""
|
"""Test the change of direction of the fan switches."""
|
||||||
await setup_integration(hass)
|
await setup_integration(hass)
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.config_entries import (
|
|||||||
ENTRY_STATE_NOT_LOADED,
|
ENTRY_STATE_NOT_LOADED,
|
||||||
ENTRY_STATE_SETUP_RETRY,
|
ENTRY_STATE_SETUP_RETRY,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from tests.components.wilight import (
|
from tests.components.wilight import (
|
||||||
HOST,
|
HOST,
|
||||||
@ -43,16 +43,14 @@ def mock_dummy_device_from_host():
|
|||||||
yield device
|
yield device
|
||||||
|
|
||||||
|
|
||||||
async def test_config_entry_not_ready(hass: HomeAssistantType) -> None:
|
async def test_config_entry_not_ready(hass: HomeAssistant) -> None:
|
||||||
"""Test the WiLight configuration entry not ready."""
|
"""Test the WiLight configuration entry not ready."""
|
||||||
entry = await setup_integration(hass)
|
entry = await setup_integration(hass)
|
||||||
|
|
||||||
assert entry.state == ENTRY_STATE_SETUP_RETRY
|
assert entry.state == ENTRY_STATE_SETUP_RETRY
|
||||||
|
|
||||||
|
|
||||||
async def test_unload_config_entry(
|
async def test_unload_config_entry(hass: HomeAssistant, dummy_device_from_host) -> None:
|
||||||
hass: HomeAssistantType, dummy_device_from_host
|
|
||||||
) -> None:
|
|
||||||
"""Test the WiLight configuration entry unloading."""
|
"""Test the WiLight configuration entry unloading."""
|
||||||
entry = await setup_integration(hass)
|
entry = await setup_integration(hass)
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ from homeassistant.const import (
|
|||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from tests.components.wilight import (
|
from tests.components.wilight import (
|
||||||
HOST,
|
HOST,
|
||||||
@ -129,7 +129,7 @@ def mock_dummy_device_from_host_color():
|
|||||||
|
|
||||||
|
|
||||||
async def test_loading_light(
|
async def test_loading_light(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
dummy_device_from_host_light_fan,
|
dummy_device_from_host_light_fan,
|
||||||
dummy_get_components_from_model_light,
|
dummy_get_components_from_model_light,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -154,7 +154,7 @@ async def test_loading_light(
|
|||||||
|
|
||||||
|
|
||||||
async def test_on_off_light_state(
|
async def test_on_off_light_state(
|
||||||
hass: HomeAssistantType, dummy_device_from_host_pb
|
hass: HomeAssistant, dummy_device_from_host_pb
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the change of state of the light switches."""
|
"""Test the change of state of the light switches."""
|
||||||
await setup_integration(hass)
|
await setup_integration(hass)
|
||||||
@ -187,7 +187,7 @@ async def test_on_off_light_state(
|
|||||||
|
|
||||||
|
|
||||||
async def test_dimmer_light_state(
|
async def test_dimmer_light_state(
|
||||||
hass: HomeAssistantType, dummy_device_from_host_dimmer
|
hass: HomeAssistant, dummy_device_from_host_dimmer
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the change of state of the light switches."""
|
"""Test the change of state of the light switches."""
|
||||||
await setup_integration(hass)
|
await setup_integration(hass)
|
||||||
@ -257,7 +257,7 @@ async def test_dimmer_light_state(
|
|||||||
|
|
||||||
|
|
||||||
async def test_color_light_state(
|
async def test_color_light_state(
|
||||||
hass: HomeAssistantType, dummy_device_from_host_color
|
hass: HomeAssistant, dummy_device_from_host_color
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the change of state of the light switches."""
|
"""Test the change of state of the light switches."""
|
||||||
await setup_integration(hass)
|
await setup_integration(hass)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user