Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick Koston
2020-05-28 23:09:07 -05:00
committed by GitHub
parent 9c45115468
commit fbe7b4ddfa
13 changed files with 173 additions and 63 deletions

View File

@@ -209,6 +209,11 @@ class HomeAssistant:
"""Return if Home Assistant is running."""
return self.state in (CoreState.starting, CoreState.running)
@property
def is_stopping(self) -> bool:
"""Return if Home Assistant is stopping."""
return self.state in (CoreState.stopping, CoreState.final_write)
def start(self) -> int:
"""Start Home Assistant.
@@ -260,6 +265,7 @@ class HomeAssistant:
setattr(self.loop, "_thread_ident", threading.get_ident())
self.bus.async_fire(EVENT_HOMEASSISTANT_START)
self.bus.async_fire(EVENT_CORE_CONFIG_UPDATE)
try:
# Only block for EVENT_HOMEASSISTANT_START listener
@@ -1391,6 +1397,7 @@ class Config:
"version": __version__,
"config_source": self.config_source,
"safe_mode": self.safe_mode,
"state": self.hass.state.value,
"external_url": self.external_url,
"internal_url": self.internal_url,
}