Resolve implicit imports (#63832)
parent
8fcca8c88b
commit
021debb5c5
|
@ -18,7 +18,8 @@ from .const import (
|
|||
GROUP_ID_READ_ONLY,
|
||||
GROUP_ID_USER,
|
||||
)
|
||||
from .permissions import PermissionLookup, system_policies
|
||||
from .permissions import system_policies
|
||||
from .permissions.models import PermissionLookup
|
||||
from .permissions.types import PolicyType
|
||||
|
||||
# mypy: disallow-any-generics
|
||||
|
|
|
@ -28,7 +28,7 @@ async def async_setup_ha_cast(
|
|||
|
||||
if user is None:
|
||||
user = await hass.auth.async_create_system_user(
|
||||
"Home Assistant Cast", group_ids=[auth.GROUP_ID_ADMIN]
|
||||
"Home Assistant Cast", group_ids=[auth.const.GROUP_ID_ADMIN]
|
||||
)
|
||||
hass.config_entries.async_update_entry(
|
||||
entry, data={**entry.data, "user_id": user.id}
|
||||
|
|
|
@ -14,7 +14,8 @@ from homeassistant.const import (
|
|||
CONF_ENTITY_ID,
|
||||
CONF_TYPE,
|
||||
)
|
||||
from homeassistant.core import Context, HomeAssistant, HomeAssistantError
|
||||
from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import get_capability, get_supported_features
|
||||
|
|
|
@ -13,7 +13,8 @@ from homeassistant.const import (
|
|||
CONF_ENTITY_ID,
|
||||
CONF_TYPE,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, HomeAssistantError, callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import condition, config_validation as cv, entity_registry
|
||||
from homeassistant.helpers.config_validation import DEVICE_CONDITION_BASE_SCHEMA
|
||||
from homeassistant.helpers.entity import get_capability, get_supported_features
|
||||
|
|
|
@ -7,12 +7,11 @@ from pycarwings2.pycarwings2 import Leaf
|
|||
from voluptuous.validators import Number
|
||||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.const import LENGTH_KILOMETERS, LENGTH_MILES, PERCENTAGE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util.distance import LENGTH_KILOMETERS, LENGTH_MILES
|
||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM, METRIC_SYSTEM
|
||||
|
||||
from . import LeafEntity
|
||||
|
|
|
@ -119,7 +119,7 @@ async def async_add_user_device_tracker(
|
|||
return
|
||||
|
||||
await coll.async_update_item(
|
||||
person[collection.CONF_ID],
|
||||
person[CONF_ID],
|
||||
{CONF_DEVICE_TRACKERS: device_trackers + [device_tracker_entity_id]},
|
||||
)
|
||||
break
|
||||
|
@ -212,7 +212,7 @@ class PersonStorageCollection(collection.StorageCollection):
|
|||
continue
|
||||
|
||||
await self.async_update_item(
|
||||
person[collection.CONF_ID],
|
||||
person[CONF_ID],
|
||||
{
|
||||
CONF_DEVICE_TRACKERS: [
|
||||
devt
|
||||
|
@ -268,10 +268,10 @@ async def filter_yaml_data(hass: HomeAssistant, persons: list[dict]) -> list[dic
|
|||
if user_id is not None and await hass.auth.async_get_user(user_id) is None:
|
||||
_LOGGER.error(
|
||||
"Invalid user_id detected for person %s",
|
||||
person_conf[collection.CONF_ID],
|
||||
person_conf[CONF_ID],
|
||||
)
|
||||
person_invalid_user.append(
|
||||
f"- Person {person_conf[CONF_NAME]} (id: {person_conf[collection.CONF_ID]}) points at invalid user {user_id}"
|
||||
f"- Person {person_conf[CONF_NAME]} (id: {person_conf[CONF_ID]}) points at invalid user {user_id}"
|
||||
)
|
||||
continue
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ from homeassistant.components.sensor import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_NAME, CURRENCY_EURO, ENERGY_KILO_WATT_HOUR
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity import DeviceEntryType, DeviceInfo
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.event import async_track_time_change
|
||||
from homeassistant.helpers.typing import StateType
|
||||
|
|
|
@ -14,11 +14,8 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import aiohttp_client
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
DataUpdateCoordinator,
|
||||
Debouncer,
|
||||
UpdateFailed,
|
||||
)
|
||||
from homeassistant.helpers.debounce import Debouncer
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
from .const import (
|
||||
DATA_COORDINATOR,
|
||||
|
|
|
@ -32,7 +32,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
from homeassistant.helpers.event import async_track_state_change_event
|
||||
from homeassistant.helpers.reload import setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import utcnow
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from . import DOMAIN, PLATFORMS
|
||||
|
||||
|
|
|
@ -6,9 +6,10 @@ from collections.abc import Awaitable, Callable
|
|||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import EVENT_COMPONENT_LOADED
|
||||
from homeassistant.core import Event, HomeAssistant
|
||||
from homeassistant.loader import async_get_integration, bind_hass
|
||||
from homeassistant.setup import ATTR_COMPONENT, EVENT_COMPONENT_LOADED
|
||||
from homeassistant.setup import ATTR_COMPONENT
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ from datetime import datetime, timedelta
|
|||
import logging
|
||||
from typing import Any, TypeVar, cast
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.const import ATTR_RESTORED, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant, State, callback, valid_entity_id
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from . import entity_registry, start
|
||||
from . import start
|
||||
from .entity import Entity
|
||||
from .event import async_track_time_interval
|
||||
from .json import JSONEncoder
|
||||
|
@ -120,7 +120,7 @@ class RestoreStateData:
|
|||
current_entity_ids = {
|
||||
state.entity_id
|
||||
for state in all_states
|
||||
if not state.attributes.get(entity_registry.ATTR_RESTORED)
|
||||
if not state.attributes.get(ATTR_RESTORED)
|
||||
}
|
||||
|
||||
# Start with the currently registered states
|
||||
|
@ -129,7 +129,7 @@ class RestoreStateData:
|
|||
for state in all_states
|
||||
if state.entity_id in self.entity_ids and
|
||||
# Ignore all states that are entity registry placeholders
|
||||
not state.attributes.get(entity_registry.ATTR_RESTORED)
|
||||
not state.attributes.get(ATTR_RESTORED)
|
||||
]
|
||||
expiration_time = now - STATE_EXPIRATION
|
||||
|
||||
|
|
Loading…
Reference in New Issue