Minor adjustment of recorder helper (#138941)

This commit is contained in:
Erik Montnemery
2025-02-20 17:28:39 +01:00
committed by GitHub
parent 66f293c8f3
commit ff4f4111d0
6 changed files with 22 additions and 13 deletions

View File

@ -20,7 +20,7 @@ if TYPE_CHECKING:
_LOGGER = logging.getLogger(__name__)
DOMAIN: HassKey[RecorderData] = HassKey("recorder")
DATA_RECORDER: HassKey[RecorderData] = HassKey("recorder")
DATA_INSTANCE: HassKey[Recorder] = HassKey("recorder_instance")
@ -52,11 +52,16 @@ def async_migration_is_live(hass: HomeAssistant) -> bool:
@callback
def async_initialize_recorder(hass: HomeAssistant) -> None:
"""Initialize recorder data."""
"""Initialize recorder data.
This creates the RecorderData instance stored in hass.data[DATA_RECORDER] and
registers the basic recorder websocket API which is used by frontend to determine
if the recorder is migrating the database.
"""
# pylint: disable-next=import-outside-toplevel
from homeassistant.components.recorder.basic_websocket_api import async_setup
hass.data[DOMAIN] = RecorderData()
hass.data[DATA_RECORDER] = RecorderData()
async_setup(hass)