Stage API

This commit is contained in:
Pascal Vizeli 2018-04-12 22:15:08 +02:00
parent 0dd7f8fbaa
commit b95ab3e95a
2 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from aiohttp import web
from .addons import APIAddons
from .discovery import APIDiscovery
from .homeassistant import APIHomeAssistant
from .hardware import APIHardware
from .host import APIHost
from .network import APINetwork
from .proxy import APIProxy
@ -37,6 +38,7 @@ class RestAPI(CoreSysAttributes):
"""Register REST API Calls."""
self._register_supervisor()
self._register_host()
self._register_hardware()
self._register_homeassistant()
self._register_proxy()
self._register_panel()
@ -53,7 +55,6 @@ class RestAPI(CoreSysAttributes):
self.webapp.add_routes([
web.get('/host/info', api_host.info),
web.get('/host/hardware', api_host.hardware),
web.post('/host/reboot', api_host.reboot),
web.post('/host/shutdown', api_host.shutdown),
web.post('/host/update', api_host.update),
@ -71,6 +72,16 @@ class RestAPI(CoreSysAttributes):
web.post('/network/options', api_net.options),
])
def _register_hardware(self):
"""Register hardware function."""
api_hardware = APIHardware()
api_hardware.coresys = self.coresys
self.webapp.add_routes([
web.get('/network/info', api_hardware.info),
web.get('/network/audio', api_hardware.audio),
])
def _register_supervisor(self):
"""Register supervisor function."""
api_supervisor = APISupervisor()

View File

@ -16,6 +16,7 @@ SCHEMA_VERSION = vol.Schema({
vol.Optional(ATTR_VERSION): vol.Coerce(str),
})
class APIHost(CoreSysAttributes):
"""Handle rest api for host functions."""