wrap panel into function

This commit is contained in:
Pascal Vizeli 2017-05-19 23:24:02 +02:00 committed by GitHub
parent 808df68e57
commit f5e196a663

View File

@ -100,8 +100,12 @@ class RestAPI(object):
def register_panel(self): def register_panel(self):
"""Register panel for homeassistant.""" """Register panel for homeassistant."""
panel = Path(__file__).parents[1].joinpath('panel/hassio-main.html') panel = Path(__file__).parents[1].joinpath('panel/hassio-main.html')
def get_panel():
"""Return file response with panel."""
return web.FileResponse(panel)
self.webapp.router.add_get('/panel', web.FileResponse(panel)) self.webapp.router.add_get('/panel', get_panel)
async def start(self): async def start(self):
"""Run rest api webserver.""" """Run rest api webserver."""