Code cleanup & add config check to API (#155)

* Code cleanup & add config check to API

* Fix comments

* fix lint p1

* Fix lint p2

* fix coro

* fix parameter

* add log output

* fix command layout

* fix Pannel

* fix lint p4

* fix regex

* convert to ascii

* fix lint p5

* add temp logging

* fix output on non-zero exit

* remove temporary log
This commit is contained in:
Pascal Vizeli
2017-08-16 02:10:38 +02:00
committed by GitHub
parent 4af92b9d25
commit 7798e7cde2
14 changed files with 173 additions and 146 deletions

View File

@@ -73,16 +73,19 @@ class APIHomeAssistant(object):
@api_process
def restart(self, request):
"""Restart homeassistant.
Return a coroutine.
"""
"""Restart homeassistant."""
return asyncio.shield(self.homeassistant.restart(), loop=self.loop)
@api_process_raw(CONTENT_TYPE_BINARY)
def logs(self, request):
"""Return homeassistant docker logs.
Return a coroutine.
"""
"""Return homeassistant docker logs."""
return self.homeassistant.logs()
@api_process
async def check(self, request):
"""Check config of homeassistant."""
code, message = await self.homeassistant.check_config()
if not code:
raise RuntimeError(message)
return True