Skip to content

Commit cc63008

Browse files
authored
Add selfupdate task (#6)
Add an optional extended description…
1 parent f9c7371 commit cc63008

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

hassio/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
HASSIO_SHARE = "/data"
1414

1515
RUN_UPDATE_INFO_TASKS = 28800
16+
RUN_UPDATE_SUPERVISOR_TASKS = 29100
1617
RUN_RELOAD_ADDONS_TASKS = 28800
1718

1819
RESTART_EXIT_CODE = 100

hassio/core.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .host_controll import HostControll
1212
from .const import (
1313
SOCKET_DOCKER, RUN_UPDATE_INFO_TASKS, RUN_RELOAD_ADDONS_TASKS,
14-
STARTUP_AFTER, STARTUP_BEFORE)
14+
RUN_UPDATE_SUPERVISOR_TASKS, STARTUP_AFTER, STARTUP_BEFORE)
1515
from .scheduler import Scheduler
1616
from .dock.homeassistant import DockerHomeAssistant
1717
from .dock.supervisor import DockerSupervisor
@@ -87,6 +87,10 @@ async def setup(self):
8787
self.scheduler.register_task(
8888
self.addons.relaod, RUN_RELOAD_ADDONS_TASKS, first_run=True)
8989

90+
# schedule self update task
91+
self.scheduler.register_task(
92+
self._hassio_update, RUN_UPDATE_SUPERVISOR_TASKS)
93+
9094
async def start(self):
9195
"""Start HassIO orchestration."""
9296
# start api
@@ -129,3 +133,12 @@ async def _setup_homeassistant(self):
129133

130134
# store version
131135
_LOGGER.info("HomeAssistant docker now installed.")
136+
137+
async def _hassio_update(self):
138+
"""Check and run update of supervisor hassio."""
139+
if self.config.current_hassio == self.supervisor.version:
140+
return
141+
142+
_LOGGER.info(
143+
"Found new HassIO version %s.", self.config.current_hassio)
144+
await self.supervisor.update(self.config.current_hassio)

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"hassio_tag": "0.7",
2+
"hassio_tag": "0.8",
33
"homeassistant_tag": "0.42.3",
44
"resinos_version": "0.3",
55
"resinhup_version": "0.1"

0 commit comments

Comments
 (0)