diff --git a/supervisor/const.py b/supervisor/const.py index 802f36ae8..51602288b 100644 --- a/supervisor/const.py +++ b/supervisor/const.py @@ -3,7 +3,7 @@ from enum import Enum from ipaddress import ip_network from pathlib import Path -SUPERVISOR_VERSION = "218" +SUPERVISOR_VERSION = "219" URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons" diff --git a/supervisor/core.py b/supervisor/core.py index f891b7d5a..f5c390312 100644 --- a/supervisor/core.py +++ b/supervisor/core.py @@ -34,9 +34,6 @@ class Core(CoreSysAttributes): """Setup supervisor orchestration.""" self.state = CoreStates.STARTUP - # load last available data - await self.sys_updater.load() - # Load DBus await self.sys_dbus.load() @@ -46,6 +43,9 @@ class Core(CoreSysAttributes): # Load Plugins container await self.sys_plugins.load() + # load last available data + await self.sys_updater.load() + # Load Home Assistant await self.sys_homeassistant.load() diff --git a/supervisor/homeassistant.py b/supervisor/homeassistant.py index decc49bf3..4a863ca38 100644 --- a/supervisor/homeassistant.py +++ b/supervisor/homeassistant.py @@ -251,6 +251,14 @@ class HomeAssistant(JsonConfig, CoreSysAttributes): """Install a landing page.""" _LOGGER.info("Setup HomeAssistant landingpage") while True: + if not self.sys_updater.image_homeassistant: + _LOGGER.warning( + "Found no information about Home Assistant. Retry in 15sec" + ) + await asyncio.sleep(15) + await self.sys_updater.reload() + continue + try: await self.instance.install( "landingpage", image=self.sys_updater.image_homeassistant diff --git a/supervisor/utils/json.py b/supervisor/utils/json.py index ecaa6fb7b..e69d612c2 100644 --- a/supervisor/utils/json.py +++ b/supervisor/utils/json.py @@ -11,6 +11,8 @@ from ..exceptions import JsonFileError _LOGGER: logging.Logger = logging.getLogger(__name__) +_DEFAULT: Dict[str, Any] = {} + def write_json_file(jsonfile: Path, data: Any) -> None: """Write a JSON file.""" @@ -37,7 +39,7 @@ class JsonConfig: """Initialize hass object.""" self._file: Path = json_file self._schema: vol.Schema = schema - self._data: Dict[str, Any] = {} + self._data: Dict[str, Any] = _DEFAULT self.read_data() @@ -68,7 +70,7 @@ class JsonConfig: # Reset data to default _LOGGER.warning("Reset %s to default", self._file) - self._data = self._schema({}) + self._data = self._schema(_DEFAULT) def save_data(self) -> None: """Store data to configuration file.""" @@ -80,6 +82,7 @@ class JsonConfig: # Load last valid data _LOGGER.warning("Reset %s to last version", self._file) + self._data = _DEFAULT self.read_data() else: # write