mirror of
https://github.com/home-assistant/core.git
synced 2025-05-03 13:39:16 +00:00
Remove HomeAssistantType alias - Part 3 (#49339)
This commit is contained in:
parent
7a9385d857
commit
006bcde435
@ -14,7 +14,7 @@ from homeassistant.const import (
|
|||||||
CONF_PROTOCOL,
|
CONF_PROTOCOL,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -39,7 +39,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
PLATFORMS = ["alarm_control_panel", "sensor", "binary_sensor"]
|
PLATFORMS = ["alarm_control_panel", "sensor", "binary_sensor"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up AlarmDecoder config flow."""
|
"""Set up AlarmDecoder config flow."""
|
||||||
undo_listener = entry.add_update_listener(_update_listener)
|
undo_listener = entry.add_update_listener(_update_listener)
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Unload a AlarmDecoder entry."""
|
"""Unload a AlarmDecoder entry."""
|
||||||
hass.data[DOMAIN][entry.entry_id][DATA_RESTART] = False
|
hass.data[DOMAIN][entry.entry_id][DATA_RESTART] = False
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def _update_listener(hass: HomeAssistantType, entry: ConfigEntry):
|
async def _update_listener(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Handle options update."""
|
"""Handle options update."""
|
||||||
_LOGGER.debug("AlarmDecoder options updated: %s", entry.as_dict()["options"])
|
_LOGGER.debug("AlarmDecoder options updated: %s", entry.as_dict()["options"])
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
@ -19,9 +19,9 @@ from homeassistant.const import (
|
|||||||
STATE_ALARM_DISARMED,
|
STATE_ALARM_DISARMED,
|
||||||
STATE_ALARM_TRIGGERED,
|
STATE_ALARM_TRIGGERED,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_ALT_NIGHT_MODE,
|
CONF_ALT_NIGHT_MODE,
|
||||||
@ -41,7 +41,7 @@ ATTR_KEYPRESS = "keypress"
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
):
|
):
|
||||||
"""Set up for AlarmDecoder alarm panels."""
|
"""Set up for AlarmDecoder alarm panels."""
|
||||||
options = entry.options
|
options = entry.options
|
||||||
|
@ -3,7 +3,7 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_RELAY_ADDR,
|
CONF_RELAY_ADDR,
|
||||||
@ -34,7 +34,7 @@ ATTR_RF_LOOP1 = "rf_loop1"
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
):
|
):
|
||||||
"""Set up for AlarmDecoder sensor."""
|
"""Set up for AlarmDecoder sensor."""
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"""Support for AlarmDecoder sensors (Shows Panel Display)."""
|
"""Support for AlarmDecoder sensors (Shows Panel Display)."""
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import SIGNAL_PANEL_MESSAGE
|
from .const import SIGNAL_PANEL_MESSAGE
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
):
|
):
|
||||||
"""Set up for AlarmDecoder sensor."""
|
"""Set up for AlarmDecoder sensor."""
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@ import async_timeout
|
|||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
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 .const import (
|
from .const import (
|
||||||
DEFAULT_SCAN_INTERVAL,
|
DEFAULT_SCAN_INTERVAL,
|
||||||
@ -33,7 +34,7 @@ async def _await_cancel(task):
|
|||||||
await task
|
await task
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistantType, config: ConfigType):
|
async def async_setup(hass: HomeAssistant, config: ConfigType):
|
||||||
"""Set up the component."""
|
"""Set up the component."""
|
||||||
hass.data[DOMAIN_DATA_ENTRIES] = {}
|
hass.data[DOMAIN_DATA_ENTRIES] = {}
|
||||||
hass.data[DOMAIN_DATA_TASKS] = {}
|
hass.data[DOMAIN_DATA_TASKS] = {}
|
||||||
@ -48,7 +49,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: config_entries.ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: config_entries.ConfigEntry):
|
||||||
"""Set up config entry."""
|
"""Set up config entry."""
|
||||||
entries = hass.data[DOMAIN_DATA_ENTRIES]
|
entries = hass.data[DOMAIN_DATA_ENTRIES]
|
||||||
tasks = hass.data[DOMAIN_DATA_TASKS]
|
tasks = hass.data[DOMAIN_DATA_TASKS]
|
||||||
|
@ -22,8 +22,7 @@ from homeassistant.components.media_player.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.components.media_player.errors import BrowseError
|
from homeassistant.components.media_player.errors import BrowseError
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .config_flow import get_entry_client
|
from .config_flow import get_entry_client
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -38,7 +37,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: config_entries.ConfigEntry,
|
||||||
async_add_entities,
|
async_add_entities,
|
||||||
):
|
):
|
||||||
|
@ -14,8 +14,8 @@ from homeassistant.const import (
|
|||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_DNSMASQ,
|
CONF_DNSMASQ,
|
||||||
@ -112,7 +112,7 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up AsusWrt platform."""
|
"""Set up AsusWrt platform."""
|
||||||
|
|
||||||
# import options from yaml if empty
|
# import options from yaml if empty
|
||||||
@ -146,7 +146,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
|||||||
return True
|
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 a config entry."""
|
||||||
unload_ok = all(
|
unload_ok = all(
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
@ -166,7 +166,7 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
|||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistantType, entry: ConfigEntry):
|
async def update_listener(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Update when config_entry options update."""
|
"""Update when config_entry options update."""
|
||||||
router = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
router = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
||||||
|
|
||||||
|
@ -4,10 +4,9 @@ from __future__ import annotations
|
|||||||
from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER
|
from homeassistant.components.device_tracker import SOURCE_TYPE_ROUTER
|
||||||
from homeassistant.components.device_tracker.config_entry import ScannerEntity
|
from homeassistant.components.device_tracker.config_entry import ScannerEntity
|
||||||
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.device_registry import CONNECTION_NETWORK_MAC
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .const import DATA_ASUSWRT, DOMAIN
|
from .const import DATA_ASUSWRT, DOMAIN
|
||||||
from .router import AsusWrtRouter
|
from .router import AsusWrtRouter
|
||||||
@ -16,7 +15,7 @@ DEFAULT_DEVICE_NAME = "Unknown device"
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up device tracker for AsusWrt component."""
|
"""Set up device tracker for AsusWrt component."""
|
||||||
router = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
router = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
||||||
|
@ -21,11 +21,10 @@ from homeassistant.const import (
|
|||||||
CONF_PROTOCOL,
|
CONF_PROTOCOL,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CALLBACK_TYPE, callback
|
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import 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 homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
@ -187,7 +186,7 @@ class AsusWrtDevInfo:
|
|||||||
class AsusWrtRouter:
|
class AsusWrtRouter:
|
||||||
"""Representation of a AsusWrt router."""
|
"""Representation of a AsusWrt router."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistantType, entry: ConfigEntry) -> None:
|
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Initialize a AsusWrt router."""
|
"""Initialize a AsusWrt router."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self._entry = entry
|
self._entry = entry
|
||||||
|
@ -7,7 +7,7 @@ from numbers import Number
|
|||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import DATA_GIGABYTES, DATA_RATE_MEGABITS_PER_SECOND
|
from homeassistant.const import DATA_GIGABYTES, DATA_RATE_MEGABITS_PER_SECOND
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import (
|
from homeassistant.helpers.update_coordinator import (
|
||||||
CoordinatorEntity,
|
CoordinatorEntity,
|
||||||
DataUpdateCoordinator,
|
DataUpdateCoordinator,
|
||||||
@ -78,7 +78,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the sensors."""
|
"""Set up the sensors."""
|
||||||
router: AsusWrtRouter = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
router: AsusWrtRouter = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
|
||||||
|
@ -10,10 +10,11 @@ from homeassistant.components.awair import AwairDataUpdateCoordinator, AwairResu
|
|||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_DEVICE_CLASS, CONF_ACCESS_TOKEN
|
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_DEVICE_CLASS, CONF_ACCESS_TOKEN
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import device_registry as dr
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -54,7 +55,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
config_entry: ConfigType,
|
config_entry: ConfigType,
|
||||||
async_add_entities: Callable[[list[Entity], bool], None],
|
async_add_entities: Callable[[list[Entity], bool], None],
|
||||||
):
|
):
|
||||||
|
@ -15,14 +15,15 @@ from homeassistant.components.azure_devops.const import (
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Azure DevOps from a config entry."""
|
"""Set up Azure DevOps from a config entry."""
|
||||||
client = DevOpsClient()
|
client = DevOpsClient()
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigType) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigType) -> bool:
|
||||||
"""Unload Azure DevOps config entry."""
|
"""Unload Azure DevOps config entry."""
|
||||||
del hass.data[f"{DOMAIN}_{entry.data[CONF_ORG]}_{entry.data[CONF_PROJECT]}"]
|
del hass.data[f"{DOMAIN}_{entry.data[CONF_ORG]}_{entry.data[CONF_PROJECT]}"]
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ from homeassistant.components.azure_devops.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ BUILDS_QUERY = "?queryOrder=queueTimeDescending&maxBuildsPerDefinition=1"
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Azure DevOps sensor based on a config entry."""
|
"""Set up Azure DevOps sensor based on a config entry."""
|
||||||
instance_key = f"{DOMAIN}_{entry.data[CONF_ORG]}_{entry.data[CONF_PROJECT]}"
|
instance_key = f"{DOMAIN}_{entry.data[CONF_ORG]}_{entry.data[CONF_PROJECT]}"
|
||||||
|
@ -21,9 +21,9 @@ from homeassistant.components.device_tracker.legacy import (
|
|||||||
async_load_config,
|
async_load_config,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICE_ID
|
from homeassistant.const import CONF_DEVICE_ID
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
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 .const import DOMAIN, SERVICE_UPDATE
|
from .const import DOMAIN, SERVICE_UPDATE
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ def discover_devices(device_id: int) -> list[tuple[str, str]]:
|
|||||||
|
|
||||||
|
|
||||||
async def see_device(
|
async def see_device(
|
||||||
hass: HomeAssistantType, async_see, mac: str, device_name: str, rssi=None
|
hass: HomeAssistant, async_see, mac: str, device_name: str, rssi=None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Mark a device as seen."""
|
"""Mark a device as seen."""
|
||||||
attributes = {}
|
attributes = {}
|
||||||
@ -80,7 +80,7 @@ async def see_device(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def get_tracking_devices(hass: HomeAssistantType) -> tuple[set[str], set[str]]:
|
async def get_tracking_devices(hass: HomeAssistant) -> tuple[set[str], set[str]]:
|
||||||
"""
|
"""
|
||||||
Load all known devices.
|
Load all known devices.
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ def lookup_name(mac: str) -> str | None:
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_scanner(
|
async def async_setup_scanner(
|
||||||
hass: HomeAssistantType, config: dict, async_see, discovery_info=None
|
hass: HomeAssistant, config: dict, async_see, discovery_info=None
|
||||||
):
|
):
|
||||||
"""Set up the Bluetooth Scanner."""
|
"""Set up the Bluetooth Scanner."""
|
||||||
device_id: int = config[CONF_DEVICE_ID]
|
device_id: int = config[CONF_DEVICE_ID]
|
||||||
|
@ -26,8 +26,8 @@ from homeassistant.const import (
|
|||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_IDENTIFIERS,
|
ATTR_IDENTIFIERS,
|
||||||
@ -74,7 +74,7 @@ BSBLAN_TO_HA_PRESET = {
|
|||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
@ -10,9 +10,9 @@ import voluptuous as vol
|
|||||||
from homeassistant.components.camera.const import DOMAIN as CAMERA_DOMAIN
|
from homeassistant.components.camera.const import DOMAIN as CAMERA_DOMAIN
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_FFMPEG_ARGUMENTS,
|
CONF_FFMPEG_ARGUMENTS,
|
||||||
@ -44,7 +44,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
PLATFORMS = ["alarm_control_panel", "camera", "sensor"]
|
PLATFORMS = ["alarm_control_panel", "camera", "sensor"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistantType, config: dict) -> bool:
|
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
||||||
"""Set up the Canary integration."""
|
"""Set up the Canary integration."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ async def async_setup(hass: HomeAssistantType, config: dict) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Canary from a config entry."""
|
"""Set up Canary from a config entry."""
|
||||||
if not entry.options:
|
if not entry.options:
|
||||||
options = {
|
options = {
|
||||||
@ -112,7 +112,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload_ok = all(
|
unload_ok = all(
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
@ -130,7 +130,7 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> boo
|
|||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistantType, entry: ConfigEntry) -> None:
|
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Handle options update."""
|
"""Handle options update."""
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ from homeassistant.const import (
|
|||||||
STATE_ALARM_ARMED_NIGHT,
|
STATE_ALARM_ARMED_NIGHT,
|
||||||
STATE_ALARM_DISARMED,
|
STATE_ALARM_DISARMED,
|
||||||
)
|
)
|
||||||
|
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.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import DATA_COORDINATOR, DOMAIN
|
from .const import DATA_COORDINATOR, DOMAIN
|
||||||
@ -27,7 +27,7 @@ from .coordinator import CanaryDataUpdateCoordinator
|
|||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
@ -12,10 +12,10 @@ import voluptuous as vol
|
|||||||
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
|
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
|
||||||
from homeassistant.components.ffmpeg import DATA_FFMPEG
|
from homeassistant.components.ffmpeg import DATA_FFMPEG
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
|
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ PLATFORM_SCHEMA = vol.All(
|
|||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
@ -10,8 +10,8 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, ConfigFlow, OptionsFlow
|
from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, ConfigFlow, OptionsFlow
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
|
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_FFMPEG_ARGUMENTS,
|
CONF_FFMPEG_ARGUMENTS,
|
||||||
@ -23,7 +23,7 @@ from .const import (
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def validate_input(hass: HomeAssistantType, data: dict) -> dict[str, Any]:
|
def validate_input(hass: HomeAssistant, data: dict) -> dict[str, Any]:
|
||||||
"""Validate the user input allows us to connect.
|
"""Validate the user input allows us to connect.
|
||||||
|
|
||||||
Data has the keys from DATA_SCHEMA with values provided by the user.
|
Data has the keys from DATA_SCHEMA with values provided by the user.
|
||||||
|
@ -6,7 +6,7 @@ from async_timeout import timeout
|
|||||||
from canary.api import Api
|
from canary.api import Api
|
||||||
from requests import ConnectTimeout, HTTPError
|
from requests import ConnectTimeout, HTTPError
|
||||||
|
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class CanaryDataUpdateCoordinator(DataUpdateCoordinator):
|
class CanaryDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
"""Class to manage fetching Canary data."""
|
"""Class to manage fetching Canary data."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistantType, *, api: Api):
|
def __init__(self, hass: HomeAssistant, *, api: Api):
|
||||||
"""Initialize global Canary data updater."""
|
"""Initialize global Canary data updater."""
|
||||||
self.canary = api
|
self.canary = api
|
||||||
update_interval = timedelta(seconds=30)
|
update_interval = timedelta(seconds=30)
|
||||||
|
@ -16,8 +16,8 @@ from homeassistant.const import (
|
|||||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
|
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.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import DATA_COORDINATOR, DOMAIN, MANUFACTURER
|
from .const import DATA_COORDINATOR, DOMAIN, MANUFACTURER
|
||||||
@ -55,7 +55,7 @@ STATE_AIR_QUALITY_VERY_ABNORMAL = "very_abnormal"
|
|||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
@ -52,11 +52,10 @@ from homeassistant.const import (
|
|||||||
STATE_PAUSED,
|
STATE_PAUSED,
|
||||||
STATE_PLAYING,
|
STATE_PLAYING,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.util.logging import async_create_catching_coro
|
from homeassistant.util.logging import async_create_catching_coro
|
||||||
|
|
||||||
@ -98,7 +97,7 @@ ENTITY_SCHEMA = vol.All(
|
|||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_create_cast_device(hass: HomeAssistantType, info: ChromecastInfo):
|
def _async_create_cast_device(hass: HomeAssistant, info: ChromecastInfo):
|
||||||
"""Create a CastDevice Entity from the chromecast object.
|
"""Create a CastDevice Entity from the chromecast object.
|
||||||
|
|
||||||
Returns None if the cast device has already been added.
|
Returns None if the cast device has already been added.
|
||||||
|
@ -6,7 +6,7 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
|
||||||
from .const import DEFAULT_PORT, DOMAIN
|
from .const import DEFAULT_PORT, DOMAIN
|
||||||
@ -18,7 +18,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
SCAN_INTERVAL = timedelta(hours=12)
|
SCAN_INTERVAL = timedelta(hours=12)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Load the saved entities."""
|
"""Load the saved entities."""
|
||||||
host = entry.data[CONF_HOST]
|
host = entry.data[CONF_HOST]
|
||||||
port = entry.data[CONF_PORT]
|
port = entry.data[CONF_PORT]
|
||||||
|
@ -26,8 +26,8 @@ from homeassistant.const import (
|
|||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.helpers.update_coordinator import (
|
from homeassistant.helpers.update_coordinator import (
|
||||||
CoordinatorEntity,
|
CoordinatorEntity,
|
||||||
DataUpdateCoordinator,
|
DataUpdateCoordinator,
|
||||||
@ -79,9 +79,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
PLATFORMS = [SENSOR_DOMAIN, WEATHER_DOMAIN]
|
PLATFORMS = [SENSOR_DOMAIN, WEATHER_DOMAIN]
|
||||||
|
|
||||||
|
|
||||||
def _set_update_interval(
|
def _set_update_interval(hass: HomeAssistant, current_entry: ConfigEntry) -> timedelta:
|
||||||
hass: HomeAssistantType, current_entry: ConfigEntry
|
|
||||||
) -> timedelta:
|
|
||||||
"""Recalculate update_interval based on existing ClimaCell instances and update them."""
|
"""Recalculate update_interval based on existing ClimaCell instances and update them."""
|
||||||
api_calls = 4 if current_entry.data[CONF_API_VERSION] == 3 else 2
|
api_calls = 4 if current_entry.data[CONF_API_VERSION] == 3 else 2
|
||||||
# We check how many ClimaCell configured instances are using the same API key and
|
# We check how many ClimaCell configured instances are using the same API key and
|
||||||
@ -111,7 +109,7 @@ def _set_update_interval(
|
|||||||
return interval
|
return interval
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||||
"""Set up ClimaCell API from a config entry."""
|
"""Set up ClimaCell API from a config entry."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
||||||
@ -172,9 +170,7 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry)
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(
|
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||||
hass: HomeAssistantType, config_entry: ConfigEntry
|
|
||||||
) -> bool:
|
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload_ok = all(
|
unload_ok = all(
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
@ -197,7 +193,7 @@ class ClimaCellDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
api: ClimaCellV3 | ClimaCellV4,
|
api: ClimaCellV3 | ClimaCellV4,
|
||||||
update_interval: timedelta,
|
update_interval: timedelta,
|
||||||
|
@ -21,10 +21,9 @@ from homeassistant.const import (
|
|||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
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 HomeAssistantType
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CC_ATTR_TEMPERATURE,
|
CC_ATTR_TEMPERATURE,
|
||||||
@ -72,7 +71,7 @@ def _get_config_schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _get_unique_id(hass: HomeAssistantType, input_dict: dict[str, Any]):
|
def _get_unique_id(hass: HomeAssistant, input_dict: dict[str, Any]):
|
||||||
"""Return unique ID from config data."""
|
"""Return unique ID from config data."""
|
||||||
return (
|
return (
|
||||||
f"{input_dict[CONF_API_KEY]}"
|
f"{input_dict[CONF_API_KEY]}"
|
||||||
|
@ -18,8 +18,8 @@ from homeassistant.const import (
|
|||||||
CONF_UNIT_SYSTEM_IMPERIAL,
|
CONF_UNIT_SYSTEM_IMPERIAL,
|
||||||
CONF_UNIT_SYSTEM_METRIC,
|
CONF_UNIT_SYSTEM_METRIC,
|
||||||
)
|
)
|
||||||
|
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 import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
from . import ClimaCellDataUpdateCoordinator, ClimaCellEntity
|
from . import ClimaCellDataUpdateCoordinator, ClimaCellEntity
|
||||||
@ -37,7 +37,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
@ -39,9 +39,9 @@ from homeassistant.const import (
|
|||||||
PRESSURE_INHG,
|
PRESSURE_INHG,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.sun import is_up
|
from homeassistant.helpers.sun import is_up
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
from homeassistant.util.distance import convert as distance_convert
|
from homeassistant.util.distance import convert as distance_convert
|
||||||
from homeassistant.util.pressure import convert as pressure_convert
|
from homeassistant.util.pressure import convert as pressure_convert
|
||||||
@ -97,7 +97,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
@ -10,10 +10,10 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_HOSTS, CONF_PASSWORD
|
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_HOSTS, CONF_PASSWORD
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
from .const import CONF_UUID, DOMAIN, KEY_MAC, TIMEOUT
|
from .const import CONF_UUID, DOMAIN, KEY_MAC, TIMEOUT
|
||||||
@ -63,7 +63,7 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Establish connection with Daikin."""
|
"""Establish connection with Daikin."""
|
||||||
conf = entry.data
|
conf = entry.data
|
||||||
# For backwards compat, set unique ID
|
# For backwards compat, set unique ID
|
||||||
|
@ -9,13 +9,13 @@ from devolo_home_control_api.mydevolo import Mydevolo
|
|||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import zeroconf
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTANT_STOP
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
|
|
||||||
from .const import CONF_MYDEVOLO, DOMAIN, GATEWAY_SERIAL_PATTERN, PLATFORMS
|
from .const import CONF_MYDEVOLO, DOMAIN, GATEWAY_SERIAL_PATTERN, PLATFORMS
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up the devolo account from a config entry."""
|
"""Set up the devolo account from a config entry."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload = all(
|
unload = all(
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
|
@ -8,7 +8,7 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .devolo_device import DevoloDeviceEntity
|
from .devolo_device import DevoloDeviceEntity
|
||||||
@ -23,7 +23,7 @@ DEVICE_CLASS_MAPPING = {
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Get all binary sensor and multi level sensor devices and setup them via config entry."""
|
"""Get all binary sensor and multi level sensor devices and setup them via config entry."""
|
||||||
entities = []
|
entities = []
|
||||||
|
@ -10,14 +10,14 @@ from homeassistant.components.climate import (
|
|||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PRECISION_HALVES, PRECISION_TENTHS
|
from homeassistant.const import PRECISION_HALVES, PRECISION_TENTHS
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .devolo_multi_level_switch import DevoloMultiLevelSwitchDeviceEntity
|
from .devolo_multi_level_switch import DevoloMultiLevelSwitchDeviceEntity
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Get all cover devices and setup them via config entry."""
|
"""Get all cover devices and setup them via config entry."""
|
||||||
entities = []
|
entities = []
|
||||||
|
@ -7,14 +7,14 @@ from homeassistant.components.cover import (
|
|||||||
CoverEntity,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .devolo_multi_level_switch import DevoloMultiLevelSwitchDeviceEntity
|
from .devolo_multi_level_switch import DevoloMultiLevelSwitchDeviceEntity
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Get all cover devices and setup them via config entry."""
|
"""Get all cover devices and setup them via config entry."""
|
||||||
entities = []
|
entities = []
|
||||||
|
@ -5,14 +5,14 @@ from homeassistant.components.light import (
|
|||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .devolo_multi_level_switch import DevoloMultiLevelSwitchDeviceEntity
|
from .devolo_multi_level_switch import DevoloMultiLevelSwitchDeviceEntity
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Get all light devices and setup them via config entry."""
|
"""Get all light devices and setup them via config entry."""
|
||||||
entities = []
|
entities = []
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components.sensor import (
|
|||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE
|
from homeassistant.const import PERCENTAGE
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .devolo_device import DevoloDeviceEntity
|
from .devolo_device import DevoloDeviceEntity
|
||||||
@ -27,7 +27,7 @@ DEVICE_CLASS_MAPPING = {
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Get all sensor devices and setup them via config entry."""
|
"""Get all sensor devices and setup them via config entry."""
|
||||||
entities = []
|
entities = []
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
"""Platform for switch integration."""
|
"""Platform for switch integration."""
|
||||||
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.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .devolo_device import DevoloDeviceEntity
|
from .devolo_device import DevoloDeviceEntity
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Get all devices and setup the switch devices via config entry."""
|
"""Get all devices and setup the switch devices via config entry."""
|
||||||
entities = []
|
entities = []
|
||||||
|
@ -11,12 +11,9 @@ import voluptuous as vol
|
|||||||
from homeassistant.components.ssdp import ATTR_SSDP_LOCATION, ATTR_UPNP_SERIAL
|
from homeassistant.components.ssdp import ATTR_SSDP_LOCATION, ATTR_UPNP_SERIAL
|
||||||
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
|
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.typing import (
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
ConfigType,
|
|
||||||
DiscoveryInfoType,
|
|
||||||
HomeAssistantType,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .const import CONF_RECEIVER_ID, DOMAIN
|
from .const import CONF_RECEIVER_ID, DOMAIN
|
||||||
|
|
||||||
@ -26,7 +23,7 @@ ERROR_CANNOT_CONNECT = "cannot_connect"
|
|||||||
ERROR_UNKNOWN = "unknown"
|
ERROR_UNKNOWN = "unknown"
|
||||||
|
|
||||||
|
|
||||||
async def validate_input(hass: HomeAssistantType, data: dict) -> dict[str, Any]:
|
async def validate_input(hass: HomeAssistant, data: dict) -> dict[str, Any]:
|
||||||
"""Validate the user input allows us to connect.
|
"""Validate the user input allows us to connect.
|
||||||
|
|
||||||
Data has the keys from DATA_SCHEMA with values provided by the user.
|
Data has the keys from DATA_SCHEMA with values provided by the user.
|
||||||
|
@ -26,7 +26,7 @@ from homeassistant.components.media_player.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_OFF, STATE_PAUSED, STATE_PLAYING
|
from homeassistant.const import STATE_OFF, STATE_PAUSED, STATE_PLAYING
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from . import DIRECTVEntity
|
from . import DIRECTVEntity
|
||||||
@ -64,7 +64,7 @@ SUPPORT_DTV_CLIENT = (
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
entry: ConfigEntry,
|
entry: ConfigEntry,
|
||||||
async_add_entities: Callable[[list, bool], None],
|
async_add_entities: Callable[[list, bool], None],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -9,7 +9,7 @@ from directv import DIRECTV, DIRECTVError
|
|||||||
|
|
||||||
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity
|
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from . import DIRECTVEntity
|
from . import DIRECTVEntity
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -20,7 +20,7 @@ SCAN_INTERVAL = timedelta(minutes=2)
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
entry: ConfigEntry,
|
entry: ConfigEntry,
|
||||||
async_add_entities: Callable[[list, bool], None],
|
async_add_entities: Callable[[list, bool], None],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -34,10 +34,10 @@ from homeassistant.const import (
|
|||||||
STATE_PAUSED,
|
STATE_PAUSED,
|
||||||
STATE_PLAYING,
|
STATE_PLAYING,
|
||||||
)
|
)
|
||||||
|
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 HomeAssistantType
|
|
||||||
from homeassistant.util import get_local_ip
|
from homeassistant.util import get_local_ip
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ def catch_request_errors():
|
|||||||
|
|
||||||
|
|
||||||
async def async_start_event_handler(
|
async def async_start_event_handler(
|
||||||
hass: HomeAssistantType,
|
hass: HomeAssistant,
|
||||||
server_host: str,
|
server_host: str,
|
||||||
server_port: int,
|
server_port: int,
|
||||||
requester,
|
requester,
|
||||||
@ -118,7 +118,7 @@ async def async_start_event_handler(
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass: HomeAssistantType, config, async_add_entities, discovery_info=None
|
hass: HomeAssistant, config, async_add_entities, discovery_info=None
|
||||||
):
|
):
|
||||||
"""Set up DLNA DMR platform."""
|
"""Set up DLNA DMR platform."""
|
||||||
if config.get(CONF_URL) is not None:
|
if config.get(CONF_URL) is not None:
|
||||||
|
@ -21,9 +21,8 @@ from homeassistant.const import (
|
|||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState, callback
|
from homeassistant.core import CoreState, HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -73,7 +72,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the DSMR sensor."""
|
"""Set up the DSMR sensor."""
|
||||||
config = entry.data
|
config = entry.data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user