diff --git a/hassio/api/__init__.py b/hassio/api/__init__.py index c3d878751..653f910aa 100644 --- a/hassio/api/__init__.py +++ b/hassio/api/__init__.py @@ -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() diff --git a/hassio/api/host.py b/hassio/api/host.py index b5efdce51..a0b63f2c9 100644 --- a/hassio/api/host.py +++ b/hassio/api/host.py @@ -16,6 +16,7 @@ SCHEMA_VERSION = vol.Schema({ vol.Optional(ATTR_VERSION): vol.Coerce(str), }) + class APIHost(CoreSysAttributes): """Handle rest api for host functions."""