mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix group loading too late resulting in incorrect state (#113262)
This commit is contained in:
parent
4ed3ea3b02
commit
c3b5e819c5
@ -36,6 +36,7 @@ from .components import (
|
|||||||
device_automation as device_automation_pre_import, # noqa: F401
|
device_automation as device_automation_pre_import, # noqa: F401
|
||||||
diagnostics as diagnostics_pre_import, # noqa: F401
|
diagnostics as diagnostics_pre_import, # noqa: F401
|
||||||
file_upload as file_upload_pre_import, # noqa: F401
|
file_upload as file_upload_pre_import, # noqa: F401
|
||||||
|
group as group_pre_import, # noqa: F401
|
||||||
history as history_pre_import, # noqa: F401
|
history as history_pre_import, # noqa: F401
|
||||||
http, # not named pre_import since it has requirements
|
http, # not named pre_import since it has requirements
|
||||||
image_upload as image_upload_import, # noqa: F401 - not named pre_import since it has requirements
|
image_upload as image_upload_import, # noqa: F401 - not named pre_import since it has requirements
|
||||||
|
@ -17,6 +17,8 @@ from homeassistant.helpers.entity import Entity
|
|||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.typing import ConfigType, StateType
|
from homeassistant.helpers.typing import ConfigType, StateType
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
_LOGGER: Final = logging.getLogger(__name__)
|
_LOGGER: Final = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_AQI: Final = "air_quality_index"
|
ATTR_AQI: Final = "air_quality_index"
|
||||||
|
@ -33,6 +33,7 @@ from homeassistant.helpers.entity import Entity, EntityDescription
|
|||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import ( # noqa: F401
|
||||||
_DEPRECATED_FORMAT_NUMBER,
|
_DEPRECATED_FORMAT_NUMBER,
|
||||||
_DEPRECATED_FORMAT_TEXT,
|
_DEPRECATED_FORMAT_TEXT,
|
||||||
|
@ -28,6 +28,8 @@ from homeassistant.helpers.entity import Entity, EntityDescription
|
|||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
|
@ -42,6 +42,7 @@ from homeassistant.helpers.temperature import display_temp as show_temp
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util.unit_conversion import TemperatureConverter
|
from homeassistant.util.unit_conversion import TemperatureConverter
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import ( # noqa: F401
|
||||||
_DEPRECATED_HVAC_MODE_AUTO,
|
_DEPRECATED_HVAC_MODE_AUTO,
|
||||||
_DEPRECATED_HVAC_MODE_COOL,
|
_DEPRECATED_HVAC_MODE_COOL,
|
||||||
|
@ -44,6 +44,8 @@ from homeassistant.helpers.entity_component import EntityComponent
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
|
@ -14,6 +14,7 @@ from homeassistant.helpers.deprecation import (
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .config_entry import ( # noqa: F401
|
from .config_entry import ( # noqa: F401
|
||||||
ScannerEntity,
|
ScannerEntity,
|
||||||
TrackerEntity,
|
TrackerEntity,
|
||||||
|
@ -40,6 +40,8 @@ from homeassistant.util.percentage import (
|
|||||||
ranged_value_to_percentage,
|
ranged_value_to_percentage,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
|
@ -52,9 +52,11 @@ from homeassistant.helpers.reload import async_reload_integration_platforms
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
from .const import CONF_HIDE_MEMBERS
|
from .const import (
|
||||||
|
CONF_HIDE_MEMBERS,
|
||||||
|
DOMAIN, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
DOMAIN = "group"
|
|
||||||
GROUP_ORDER = "group_order"
|
GROUP_ORDER = "group_order"
|
||||||
|
|
||||||
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
||||||
@ -241,7 +243,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
|
|
||||||
hass.data[REG_KEY] = GroupIntegrationRegistry()
|
hass.data[REG_KEY] = GroupIntegrationRegistry()
|
||||||
|
|
||||||
await async_process_integration_platforms(hass, DOMAIN, _process_group_platform)
|
await async_process_integration_platforms(
|
||||||
|
hass, DOMAIN, _process_group_platform, wait_for_platforms=True
|
||||||
|
)
|
||||||
|
|
||||||
await _async_process_config(hass, config)
|
await _async_process_config(hass, config)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from collections.abc import Callable, Coroutine, Mapping
|
from collections.abc import Callable, Coroutine, Mapping
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Any, cast
|
from typing import TYPE_CHECKING, Any, cast
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -22,9 +22,11 @@ from homeassistant.helpers.schema_config_entry_flow import (
|
|||||||
entity_selector_without_own_entities,
|
entity_selector_without_own_entities,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import DOMAIN, GroupEntity
|
if TYPE_CHECKING:
|
||||||
|
from . import GroupEntity
|
||||||
|
|
||||||
from .binary_sensor import CONF_ALL, async_create_preview_binary_sensor
|
from .binary_sensor import CONF_ALL, async_create_preview_binary_sensor
|
||||||
from .const import CONF_HIDE_MEMBERS, CONF_IGNORE_NON_NUMERIC
|
from .const import CONF_HIDE_MEMBERS, CONF_IGNORE_NON_NUMERIC, DOMAIN
|
||||||
from .cover import async_create_preview_cover
|
from .cover import async_create_preview_cover
|
||||||
from .event import async_create_preview_event
|
from .event import async_create_preview_event
|
||||||
from .fan import async_create_preview_fan
|
from .fan import async_create_preview_fan
|
||||||
|
@ -2,3 +2,5 @@
|
|||||||
|
|
||||||
CONF_HIDE_MEMBERS = "hide_members"
|
CONF_HIDE_MEMBERS = "hide_members"
|
||||||
CONF_IGNORE_NON_NUMERIC = "ignore_non_numeric"
|
CONF_IGNORE_NON_NUMERIC = "ignore_non_numeric"
|
||||||
|
|
||||||
|
DOMAIN = "group"
|
||||||
|
@ -34,6 +34,7 @@ from homeassistant.helpers.entity_component import EntityComponent
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import ( # noqa: F401
|
||||||
_DEPRECATED_DEVICE_CLASS_DEHUMIDIFIER,
|
_DEPRECATED_DEVICE_CLASS_DEHUMIDIFIER,
|
||||||
_DEPRECATED_DEVICE_CLASS_HUMIDIFIER,
|
_DEPRECATED_DEVICE_CLASS_HUMIDIFIER,
|
||||||
|
@ -34,6 +34,8 @@ from homeassistant.helpers.typing import ConfigType
|
|||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
|
@ -42,6 +42,8 @@ from homeassistant.helpers.entity import Entity, EntityDescription
|
|||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.typing import ConfigType, StateType
|
from homeassistant.helpers.typing import ConfigType, StateType
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
|
@ -63,6 +63,7 @@ from homeassistant.helpers.network import get_url
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .browse_media import BrowseMedia, async_process_play_media_url # noqa: F401
|
from .browse_media import BrowseMedia, async_process_play_media_url # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import ( # noqa: F401
|
||||||
ATTR_APP_ID,
|
ATTR_APP_ID,
|
||||||
|
@ -57,6 +57,8 @@ from homeassistant.helpers.storage import Store
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_SOURCE = "source"
|
ATTR_SOURCE = "source"
|
||||||
|
@ -32,6 +32,7 @@ from homeassistant.helpers.event import (
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_DICT_OF_UNITS_OF_MEASUREMENT,
|
ATTR_DICT_OF_UNITS_OF_MEASUREMENT,
|
||||||
ATTR_MAX_BRIGHTNESS_HISTORY,
|
ATTR_MAX_BRIGHTNESS_HISTORY,
|
||||||
|
@ -37,6 +37,8 @@ from homeassistant.helpers.entity_component import EntityComponent
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
|
@ -70,6 +70,7 @@ from homeassistant.helpers.typing import UNDEFINED, ConfigType, StateType, Undef
|
|||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
from homeassistant.util.enum import try_parse_enum
|
from homeassistant.util.enum import try_parse_enum
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import ( # noqa: F401
|
||||||
_DEPRECATED_STATE_CLASS_MEASUREMENT,
|
_DEPRECATED_STATE_CLASS_MEASUREMENT,
|
||||||
_DEPRECATED_STATE_CLASS_TOTAL,
|
_DEPRECATED_STATE_CLASS_TOTAL,
|
||||||
|
@ -33,6 +33,7 @@ from homeassistant.helpers.entity_component import EntityComponent
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -35,6 +35,14 @@ from homeassistant.helpers.icon import icon_for_battery_level
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
from .const import ( # noqa: F401
|
||||||
|
STATE_CLEANING,
|
||||||
|
STATE_DOCKED,
|
||||||
|
STATE_ERROR,
|
||||||
|
STATE_RETURNING,
|
||||||
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
@ -64,11 +72,6 @@ SERVICE_PAUSE = "pause"
|
|||||||
SERVICE_STOP = "stop"
|
SERVICE_STOP = "stop"
|
||||||
|
|
||||||
|
|
||||||
STATE_CLEANING = "cleaning"
|
|
||||||
STATE_DOCKED = "docked"
|
|
||||||
STATE_RETURNING = "returning"
|
|
||||||
STATE_ERROR = "error"
|
|
||||||
|
|
||||||
STATES = [STATE_CLEANING, STATE_DOCKED, STATE_RETURNING, STATE_ERROR]
|
STATES = [STATE_CLEANING, STATE_DOCKED, STATE_RETURNING, STATE_ERROR]
|
||||||
|
|
||||||
DEFAULT_NAME = "Vacuum cleaner robot"
|
DEFAULT_NAME = "Vacuum cleaner robot"
|
||||||
|
8
homeassistant/components/vacuum/const.py
Normal file
8
homeassistant/components/vacuum/const.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
"""Support for vacuum cleaner robots (botvacs)."""
|
||||||
|
|
||||||
|
STATE_CLEANING = "cleaning"
|
||||||
|
STATE_DOCKED = "docked"
|
||||||
|
STATE_RETURNING = "returning"
|
||||||
|
STATE_ERROR = "error"
|
||||||
|
|
||||||
|
STATES = [STATE_CLEANING, STATE_DOCKED, STATE_RETURNING, STATE_ERROR]
|
@ -4,7 +4,7 @@ from homeassistant.components.group import GroupIntegrationRegistry
|
|||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
|
||||||
from . import STATE_CLEANING, STATE_ERROR, STATE_RETURNING
|
from .const import STATE_CLEANING, STATE_ERROR, STATE_RETURNING
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -42,6 +42,8 @@ from homeassistant.helpers.temperature import display_temp as show_temp
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util.unit_conversion import TemperatureConverter
|
from homeassistant.util.unit_conversion import TemperatureConverter
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
else:
|
else:
|
||||||
|
8
homeassistant/components/water_heater/const.py
Normal file
8
homeassistant/components/water_heater/const.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
"""Support for water heater devices."""
|
||||||
|
|
||||||
|
STATE_ECO = "eco"
|
||||||
|
STATE_ELECTRIC = "electric"
|
||||||
|
STATE_PERFORMANCE = "performance"
|
||||||
|
STATE_HIGH_DEMAND = "high_demand"
|
||||||
|
STATE_HEAT_PUMP = "heat_pump"
|
||||||
|
STATE_GAS = "gas"
|
@ -4,7 +4,7 @@ from homeassistant.components.group import GroupIntegrationRegistry
|
|||||||
from homeassistant.const import STATE_OFF
|
from homeassistant.const import STATE_OFF
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
|
||||||
from . import (
|
from .const import (
|
||||||
STATE_ECO,
|
STATE_ECO,
|
||||||
STATE_ELECTRIC,
|
STATE_ELECTRIC,
|
||||||
STATE_GAS,
|
STATE_GAS,
|
||||||
|
@ -61,6 +61,7 @@ from homeassistant.util.dt import utcnow
|
|||||||
from homeassistant.util.json import JsonValueType
|
from homeassistant.util.json import JsonValueType
|
||||||
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
|
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
|
||||||
|
|
||||||
|
from . import group as group_pre_import # noqa: F401
|
||||||
from .const import ( # noqa: F401
|
from .const import ( # noqa: F401
|
||||||
ATTR_WEATHER_APPARENT_TEMPERATURE,
|
ATTR_WEATHER_APPARENT_TEMPERATURE,
|
||||||
ATTR_WEATHER_CLOUD_COVERAGE,
|
ATTR_WEATHER_CLOUD_COVERAGE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user