mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Combine recorder and frontend bootstrap step (#113985)
This commit is contained in:
parent
bf8d880e5f
commit
952f47ab18
@ -194,16 +194,14 @@ CRITICAL_INTEGRATIONS = {
|
|||||||
"frontend",
|
"frontend",
|
||||||
}
|
}
|
||||||
|
|
||||||
SETUP_ORDER = {
|
SETUP_ORDER = (
|
||||||
# Load logging as soon as possible
|
# Load logging as soon as possible
|
||||||
"logging": LOGGING_INTEGRATIONS,
|
("logging", LOGGING_INTEGRATIONS),
|
||||||
# Setup frontend
|
# Setup frontend and recorder
|
||||||
"frontend": FRONTEND_INTEGRATIONS,
|
("frontend, recorder", {*FRONTEND_INTEGRATIONS, *RECORDER_INTEGRATIONS}),
|
||||||
# Setup recorder
|
|
||||||
"recorder": RECORDER_INTEGRATIONS,
|
|
||||||
# Start up debuggers. Start these first in case they want to wait.
|
# Start up debuggers. Start these first in case they want to wait.
|
||||||
"debugger": DEBUGGER_INTEGRATIONS,
|
("debugger", DEBUGGER_INTEGRATIONS),
|
||||||
}
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_hass(
|
async def async_setup_hass(
|
||||||
@ -856,10 +854,9 @@ async def _async_set_up_integrations(
|
|||||||
if "recorder" in domains_to_setup:
|
if "recorder" in domains_to_setup:
|
||||||
recorder.async_initialize_recorder(hass)
|
recorder.async_initialize_recorder(hass)
|
||||||
|
|
||||||
pre_stage_domains: dict[str, set[str]] = {
|
pre_stage_domains = [
|
||||||
name: domains_to_setup & domain_group
|
(name, domains_to_setup & domain_group) for name, domain_group in SETUP_ORDER
|
||||||
for name, domain_group in SETUP_ORDER.items()
|
]
|
||||||
}
|
|
||||||
|
|
||||||
# calculate what components to setup in what stage
|
# calculate what components to setup in what stage
|
||||||
stage_1_domains: set[str] = set()
|
stage_1_domains: set[str] = set()
|
||||||
@ -885,7 +882,7 @@ async def _async_set_up_integrations(
|
|||||||
|
|
||||||
stage_2_domains = domains_to_setup - stage_1_domains
|
stage_2_domains = domains_to_setup - stage_1_domains
|
||||||
|
|
||||||
for name, domain_group in pre_stage_domains.items():
|
for name, domain_group in pre_stage_domains:
|
||||||
if domain_group:
|
if domain_group:
|
||||||
stage_2_domains -= domain_group
|
stage_2_domains -= domain_group
|
||||||
_LOGGER.info("Setting up %s: %s", name, domain_group)
|
_LOGGER.info("Setting up %s: %s", name, domain_group)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"domain": "recorder",
|
"domain": "recorder",
|
||||||
"name": "Recorder",
|
"name": "Recorder",
|
||||||
|
"after_dependencies": ["http"],
|
||||||
"codeowners": ["@home-assistant/core"],
|
"codeowners": ["@home-assistant/core"],
|
||||||
"documentation": "https://www.home-assistant.io/integrations/recorder",
|
"documentation": "https://www.home-assistant.io/integrations/recorder",
|
||||||
"integration_type": "system",
|
"integration_type": "system",
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.components.humidifier import (
|
|||||||
from homeassistant.components.recorder import Recorder
|
from homeassistant.components.recorder import Recorder
|
||||||
from homeassistant.components.recorder.history import get_significant_states
|
from homeassistant.components.recorder.history import get_significant_states
|
||||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant, split_entity_id
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
@ -37,7 +37,10 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
|||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for entity_states in states.values():
|
||||||
for state in entity_states:
|
for state in filter(
|
||||||
|
lambda state: split_entity_id(state.entity_id)[0] == humidifier.DOMAIN,
|
||||||
|
entity_states,
|
||||||
|
):
|
||||||
assert ATTR_MIN_HUMIDITY not in state.attributes
|
assert ATTR_MIN_HUMIDITY not in state.attributes
|
||||||
assert ATTR_MAX_HUMIDITY not in state.attributes
|
assert ATTR_MAX_HUMIDITY not in state.attributes
|
||||||
assert ATTR_AVAILABLE_MODES not in state.attributes
|
assert ATTR_AVAILABLE_MODES not in state.attributes
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components.recorder import Recorder
|
|||||||
from homeassistant.components.recorder.history import get_significant_states
|
from homeassistant.components.recorder.history import get_significant_states
|
||||||
from homeassistant.components.siren import ATTR_AVAILABLE_TONES
|
from homeassistant.components.siren import ATTR_AVAILABLE_TONES
|
||||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant, split_entity_id
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
@ -33,6 +33,9 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
|||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for entity_states in states.values():
|
||||||
for state in entity_states:
|
for state in filter(
|
||||||
|
lambda state: split_entity_id(state.entity_id)[0] == siren.DOMAIN,
|
||||||
|
entity_states,
|
||||||
|
):
|
||||||
assert ATTR_AVAILABLE_TONES not in state.attributes
|
assert ATTR_AVAILABLE_TONES not in state.attributes
|
||||||
assert ATTR_FRIENDLY_NAME in state.attributes
|
assert ATTR_FRIENDLY_NAME in state.attributes
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components.recorder import Recorder
|
|||||||
from homeassistant.components.recorder.history import get_significant_states
|
from homeassistant.components.recorder.history import get_significant_states
|
||||||
from homeassistant.components.vacuum import ATTR_FAN_SPEED_LIST
|
from homeassistant.components.vacuum import ATTR_FAN_SPEED_LIST
|
||||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant, split_entity_id
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
@ -33,6 +33,9 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
|||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for entity_states in states.values():
|
||||||
for state in entity_states:
|
for state in filter(
|
||||||
|
lambda state: split_entity_id(state.entity_id)[0] == vacuum.DOMAIN,
|
||||||
|
entity_states,
|
||||||
|
):
|
||||||
assert ATTR_FAN_SPEED_LIST not in state.attributes
|
assert ATTR_FAN_SPEED_LIST not in state.attributes
|
||||||
assert ATTR_FRIENDLY_NAME in state.attributes
|
assert ATTR_FRIENDLY_NAME in state.attributes
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.components.water_heater import (
|
|||||||
ATTR_OPERATION_LIST,
|
ATTR_OPERATION_LIST,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant, split_entity_id
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
@ -37,7 +37,10 @@ async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant)
|
|||||||
)
|
)
|
||||||
assert len(states) >= 1
|
assert len(states) >= 1
|
||||||
for entity_states in states.values():
|
for entity_states in states.values():
|
||||||
for state in entity_states:
|
for state in filter(
|
||||||
|
lambda state: split_entity_id(state.entity_id)[0] == water_heater.DOMAIN,
|
||||||
|
entity_states,
|
||||||
|
):
|
||||||
assert ATTR_OPERATION_LIST not in state.attributes
|
assert ATTR_OPERATION_LIST not in state.attributes
|
||||||
assert ATTR_MIN_TEMP not in state.attributes
|
assert ATTR_MIN_TEMP not in state.attributes
|
||||||
assert ATTR_MAX_TEMP not in state.attributes
|
assert ATTR_MAX_TEMP not in state.attributes
|
||||||
|
@ -359,6 +359,9 @@ async def test_setup_frontend_before_recorder(hass: HomeAssistant) -> None:
|
|||||||
MockModule(
|
MockModule(
|
||||||
domain="recorder",
|
domain="recorder",
|
||||||
async_setup=gen_domain_setup("recorder"),
|
async_setup=gen_domain_setup("recorder"),
|
||||||
|
partial_manifest={
|
||||||
|
"after_dependencies": ["http"],
|
||||||
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user