Indicate database migration in /api/core/state response (#122445)

* Indicate database migration in /api/core/state response

* Change API response according to review comment

* Adjust API response

* Update test

* Add test
This commit is contained in:
Erik Montnemery
2024-07-23 14:13:08 +02:00
committed by GitHub
parent 73ea62edd4
commit 92acfc1464
4 changed files with 73 additions and 16 deletions

View File

@@ -20,16 +20,24 @@ class RecorderData:
db_connected: asyncio.Future[bool] = field(default_factory=asyncio.Future)
@callback
def async_migration_in_progress(hass: HomeAssistant) -> bool:
"""Check to see if a recorder migration is in progress."""
if "recorder" not in hass.config.components:
return False
# pylint: disable-next=import-outside-toplevel
from homeassistant.components import recorder
return recorder.util.async_migration_in_progress(hass)
@callback
def async_migration_is_live(hass: HomeAssistant) -> bool:
"""Check to see if a recorder migration is live."""
# pylint: disable-next=import-outside-toplevel
from homeassistant.components import recorder
return recorder.util.async_migration_is_live(hass)
@callback
def async_initialize_recorder(hass: HomeAssistant) -> None:
"""Initialize recorder data."""