mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-19 23:26:29 +00:00
Cleanup API
This commit is contained in:
parent
0593885ed4
commit
9f5903089e
12
API.md
12
API.md
@ -226,14 +226,15 @@ return:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "",
|
|
||||||
"version": "",
|
|
||||||
"last_version": "",
|
|
||||||
"features": ["shutdown", "reboot", "update", "hostname", "network_info", "network_control"],
|
|
||||||
"hostname": "",
|
"hostname": "",
|
||||||
|
"features": ["shutdown", "reboot", "update", "hostname"],
|
||||||
"operating_system": "",
|
"operating_system": "",
|
||||||
"kernel": "",
|
"kernel": "",
|
||||||
"chassis": ""
|
"chassis": "",
|
||||||
|
"machine": "",
|
||||||
|
"deployment": "",
|
||||||
|
"version": "",
|
||||||
|
"last_version": "",
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -302,6 +303,7 @@ Optional:
|
|||||||
{
|
{
|
||||||
"version": "INSTALL_VERSION",
|
"version": "INSTALL_VERSION",
|
||||||
"last_version": "LAST_VERSION",
|
"last_version": "LAST_VERSION",
|
||||||
|
"machine": "Image machine type",
|
||||||
"image": "str",
|
"image": "str",
|
||||||
"custom": "bool -> if custom image",
|
"custom": "bool -> if custom image",
|
||||||
"boot": "bool",
|
"boot": "bool",
|
||||||
|
@ -9,7 +9,8 @@ from ..const import (
|
|||||||
ATTR_VERSION, ATTR_LAST_VERSION, ATTR_IMAGE, ATTR_CUSTOM, ATTR_BOOT,
|
ATTR_VERSION, ATTR_LAST_VERSION, ATTR_IMAGE, ATTR_CUSTOM, ATTR_BOOT,
|
||||||
ATTR_PORT, ATTR_PASSWORD, ATTR_SSL, ATTR_WATCHDOG, ATTR_CPU_PERCENT,
|
ATTR_PORT, ATTR_PASSWORD, ATTR_SSL, ATTR_WATCHDOG, ATTR_CPU_PERCENT,
|
||||||
ATTR_MEMORY_USAGE, ATTR_MEMORY_LIMIT, ATTR_NETWORK_RX, ATTR_NETWORK_TX,
|
ATTR_MEMORY_USAGE, ATTR_MEMORY_LIMIT, ATTR_NETWORK_RX, ATTR_NETWORK_TX,
|
||||||
ATTR_BLK_READ, ATTR_BLK_WRITE, ATTR_WAIT_BOOT, CONTENT_TYPE_BINARY)
|
ATTR_BLK_READ, ATTR_BLK_WRITE, ATTR_WAIT_BOOT, ATTR_MACHINE,
|
||||||
|
CONTENT_TYPE_BINARY)
|
||||||
from ..coresys import CoreSysAttributes
|
from ..coresys import CoreSysAttributes
|
||||||
from ..validate import NETWORK_PORT, DOCKER_IMAGE
|
from ..validate import NETWORK_PORT, DOCKER_IMAGE
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ class APIHomeAssistant(CoreSysAttributes):
|
|||||||
return {
|
return {
|
||||||
ATTR_VERSION: self.sys_homeassistant.version,
|
ATTR_VERSION: self.sys_homeassistant.version,
|
||||||
ATTR_LAST_VERSION: self.sys_homeassistant.last_version,
|
ATTR_LAST_VERSION: self.sys_homeassistant.last_version,
|
||||||
|
ATTR_MACHINE: self.sys_homeassistant.machine,
|
||||||
ATTR_IMAGE: self.sys_homeassistant.image,
|
ATTR_IMAGE: self.sys_homeassistant.image,
|
||||||
ATTR_CUSTOM: self.sys_homeassistant.is_custom_image,
|
ATTR_CUSTOM: self.sys_homeassistant.is_custom_image,
|
||||||
ATTR_BOOT: self.sys_homeassistant.boot,
|
ATTR_BOOT: self.sys_homeassistant.boot,
|
||||||
|
@ -52,6 +52,7 @@ ENV_TIME = 'TZ'
|
|||||||
|
|
||||||
REQUEST_FROM = 'HASSIO_FROM'
|
REQUEST_FROM = 'HASSIO_FROM'
|
||||||
|
|
||||||
|
ATTR_MACHINE = 'machine'
|
||||||
ATTR_WAIT_BOOT = 'wait_boot'
|
ATTR_WAIT_BOOT = 'wait_boot'
|
||||||
ATTR_WATCHDOG = 'watchdog'
|
ATTR_WATCHDOG = 'watchdog'
|
||||||
ATTR_CHANGELOG = 'changelog'
|
ATTR_CHANGELOG = 'changelog'
|
||||||
|
@ -6,8 +6,6 @@ from ..exceptions import HassioError, HostNotSupportedError
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
UNKNOWN = 'Unknown'
|
|
||||||
|
|
||||||
|
|
||||||
class InfoCenter(CoreSysAttributes):
|
class InfoCenter(CoreSysAttributes):
|
||||||
"""Handle local system information controls."""
|
"""Handle local system information controls."""
|
||||||
@ -20,27 +18,32 @@ class InfoCenter(CoreSysAttributes):
|
|||||||
@property
|
@property
|
||||||
def hostname(self):
|
def hostname(self):
|
||||||
"""Return local hostname."""
|
"""Return local hostname."""
|
||||||
return self._data.get('Hostname', UNKNOWN)
|
return self._data.get('Hostname') or None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def chassis(self):
|
def chassis(self):
|
||||||
"""Return local chassis type."""
|
"""Return local chassis type."""
|
||||||
return self._data.get('Chassis', UNKNOWN)
|
return self._data.get('Chassis') or None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def deployment(self):
|
||||||
|
"""Return local deployment type."""
|
||||||
|
return self._data.get('Deployment') or None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def kernel(self):
|
def kernel(self):
|
||||||
"""Return local kernel version."""
|
"""Return local kernel version."""
|
||||||
return self._data.get('KernelRelease', UNKNOWN)
|
return self._data.get('KernelRelease') or None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def operating_system(self):
|
def operating_system(self):
|
||||||
"""Return local operating system."""
|
"""Return local operating system."""
|
||||||
return self._data.get('OperatingSystemPrettyName', UNKNOWN)
|
return self._data.get('OperatingSystemPrettyName') or None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cpe(self):
|
def cpe(self):
|
||||||
"""Return local CPE."""
|
"""Return local CPE."""
|
||||||
return self._data.get('OperatingSystemCPEName', UNKNOWN)
|
return self._data.get('OperatingSystemCPEName') or None
|
||||||
|
|
||||||
async def update(self):
|
async def update(self):
|
||||||
"""Update properties over dbus."""
|
"""Update properties over dbus."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user