diff --git a/hassio/addons/data.py b/hassio/addons/data.py index 51c652cb1..58d7452d1 100644 --- a/hassio/addons/data.py +++ b/hassio/addons/data.py @@ -15,7 +15,7 @@ from .validate import ( from ..const import ( FILE_HASSIO_ADDONS, ATTR_VERSION, ATTR_SLUG, ATTR_REPOSITORY, ATTR_LOCATON, REPOSITORY_CORE, REPOSITORY_LOCAL, ATTR_USER, ATTR_SYSTEM) -from ..tools import JsonConfig +from ..tools import JsonConfig, read_json_file _LOGGER = logging.getLogger(__name__) diff --git a/hassio/api/addons.py b/hassio/api/addons.py index b03e582a4..1f9e96663 100644 --- a/hassio/api/addons.py +++ b/hassio/api/addons.py @@ -11,7 +11,6 @@ from ..const import ( ATTR_URL, ATTR_DESCRIPTON, ATTR_DETACHED, ATTR_NAME, ATTR_REPOSITORY, ATTR_BUILD, ATTR_AUTO_UPDATE, ATTR_NETWORK, ATTR_HOST_NETWORK, BOOT_AUTO, BOOT_MANUAL) -from ..tools import read_json_file from ..validate import DOCKER_PORTS _LOGGER = logging.getLogger(__name__) diff --git a/hassio/homeassistant.py b/hassio/homeassistant.py index 6f4464459..627856f19 100644 --- a/hassio/homeassistant.py +++ b/hassio/homeassistant.py @@ -101,13 +101,13 @@ class HomeAssistant(JsonConfig): while True: # read homeassistant tag and install it if not self.last_version: - await self.config.fetch_update_infos(websession) + await self.config.fetch_update_infos(self.websession) tag = self.last_version if tag and await self.docker.install(tag): break _LOGGER.warning("Error on install HomeAssistant. Retry in 60sec") - await asyncio.sleep(60, loop=loop) + await asyncio.sleep(60, loop=self.loop) # store version _LOGGER.info("HomeAssistant docker now installed") @@ -147,3 +147,10 @@ class HomeAssistant(JsonConfig): Return a coroutine. """ return self.docker.logs() + + def is_running(self): + """Return True if docker container is running. + + Return a coroutine. + """ + return self.docker.is_running() diff --git a/hassio/snapshots/snapshot.py b/hassio/snapshots/snapshot.py index a8730e20a..41a03a8f3 100644 --- a/hassio/snapshots/snapshot.py +++ b/hassio/snapshots/snapshot.py @@ -128,7 +128,7 @@ class Snapshot(object): self.homeassistant_devices = homeassistant.devices # custom image - if self.homeassistant.is_custom_image: + if homeassistant.is_custom_image: self.homeassistant_image = homeassistant.image def restore_homeassistant(self, homeassistant): diff --git a/hassio/validate.py b/hassio/validate.py index 88c2cf2ca..ae0cb5a60 100644 --- a/hassio/validate.py +++ b/hassio/validate.py @@ -37,6 +37,6 @@ DOCKER_PORTS = vol.Schema({ SCHEMA_HASS_CONFIG = vol.Schema({ vol.Optional(ATTR_DEVICES, default=[]): HASS_DEVICES, - vol.inclusive(ATTR_IMAGE, 'custom_hass'): vol.Coerce(str), - vol.inclusive(ATTR_LAST_VERSION, 'custom_hass'): vol.Coerce(str), + vol.Inclusive(ATTR_IMAGE, 'custom_hass'): vol.Coerce(str), + vol.Inclusive(ATTR_LAST_VERSION, 'custom_hass'): vol.Coerce(str), })