1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-20 18:38:59 +00:00

Add restart support to homeassistant and add-ons (#37)

This commit is contained in:
Pascal Vizeli
2017-05-08 23:31:30 +02:00
committed by GitHub
parent 63b96700e0
commit f59f0793bc
7 changed files with 58 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ class APIHomeAssistant(object):
@api_process
async def update(self, request):
"""Update host OS."""
"""Update homeassistant."""
body = await api_validate(SCHEMA_VERSION, request)
version = body.get(ATTR_VERSION, self.config.last_homeassistant)
@@ -48,6 +48,15 @@ class APIHomeAssistant(object):
return await asyncio.shield(
self.homeassistant.update(version), loop=self.loop)
@api_process
async def restart(self, request):
"""Restart homeassistant."""
if self.homeassistant.in_progress:
raise RuntimeError("Other task is in progress")
return await asyncio.shield(
self.homeassistant.restart(), loop=self.loop)
@api_process_raw
def logs(self, request):
"""Return homeassistant docker logs.