mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-06-26 03:46:29 +00:00

* Add support for hassos * Name command * Update host.py * Create hassos.py * Update const.py * Update host.py * Update API.md * Update const.py * Update __init__.py * Update hassos.py * Update hassos.py * Update hassos.py * Update hassos.py * Update const.py * Update API.md * Update hassos.py * Update hassos.py * Update API.md * Update const.py * Update hassos.py * Update __init__.py * fix lint * Fix lint v2 * remove old function * fix attribute error * inittialize hassos * Fix link * fix error handling * Fix handling
34 lines
886 B
Python
34 lines
886 B
Python
"""Init file for Hass.io hassos rest api."""
|
|
import asyncio
|
|
import logging
|
|
|
|
import voluptuous as vol
|
|
|
|
from .utils import api_process
|
|
from ..const import ATTR_VERSION, ATTR_BOARD, ATTR_VERSION_LATEST
|
|
from ..coresys import CoreSysAttributes
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
SCHEMA_VERSION = vol.Schema({
|
|
vol.Optional(ATTR_VERSION): vol.Coerce(str),
|
|
})
|
|
|
|
|
|
class APIHassOS(CoreSysAttributes):
|
|
"""Handle rest api for hassos functions."""
|
|
|
|
@api_process
|
|
async def info(self, request):
|
|
"""Return hassos information."""
|
|
return {
|
|
ATTR_VERSION: self.sys_hassos.version,
|
|
ATTR_VERSION_LATEST: self.sys_hassos.version,
|
|
ATTR_BOARD: self.sys_hassos.board,
|
|
}
|
|
|
|
@api_process
|
|
def config_sync(self, request):
|
|
"""Trigger config reload on HassOS."""
|
|
return asyncio.shield(self.sys_hassos.config_sync())
|