diff --git a/API.md b/API.md index 9b78563d9..032e32143 100644 --- a/API.md +++ b/API.md @@ -226,14 +226,15 @@ return: ```json { - "type": "", - "version": "", - "last_version": "", - "features": ["shutdown", "reboot", "update", "hostname", "network_info", "network_control"], "hostname": "", + "features": ["shutdown", "reboot", "update", "hostname"], "operating_system": "", "kernel": "", - "chassis": "" + "chassis": "", + "machine": "", + "deployment": "", + "version": "", + "last_version": "", } ``` @@ -302,6 +303,7 @@ Optional: { "version": "INSTALL_VERSION", "last_version": "LAST_VERSION", + "machine": "Image machine type", "image": "str", "custom": "bool -> if custom image", "boot": "bool", diff --git a/hassio/api/homeassistant.py b/hassio/api/homeassistant.py index 8e9c07359..dd5e9698b 100644 --- a/hassio/api/homeassistant.py +++ b/hassio/api/homeassistant.py @@ -9,7 +9,8 @@ from ..const import ( ATTR_VERSION, ATTR_LAST_VERSION, ATTR_IMAGE, ATTR_CUSTOM, ATTR_BOOT, ATTR_PORT, ATTR_PASSWORD, ATTR_SSL, ATTR_WATCHDOG, ATTR_CPU_PERCENT, 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 ..validate import NETWORK_PORT, DOCKER_IMAGE @@ -45,6 +46,7 @@ class APIHomeAssistant(CoreSysAttributes): return { ATTR_VERSION: self.sys_homeassistant.version, ATTR_LAST_VERSION: self.sys_homeassistant.last_version, + ATTR_MACHINE: self.sys_homeassistant.machine, ATTR_IMAGE: self.sys_homeassistant.image, ATTR_CUSTOM: self.sys_homeassistant.is_custom_image, ATTR_BOOT: self.sys_homeassistant.boot, diff --git a/hassio/const.py b/hassio/const.py index ad5b26cb4..fbbd3a147 100644 --- a/hassio/const.py +++ b/hassio/const.py @@ -52,6 +52,7 @@ ENV_TIME = 'TZ' REQUEST_FROM = 'HASSIO_FROM' +ATTR_MACHINE = 'machine' ATTR_WAIT_BOOT = 'wait_boot' ATTR_WATCHDOG = 'watchdog' ATTR_CHANGELOG = 'changelog' diff --git a/hassio/host/info.py b/hassio/host/info.py index 3e0caeae3..af282c4c7 100644 --- a/hassio/host/info.py +++ b/hassio/host/info.py @@ -6,8 +6,6 @@ from ..exceptions import HassioError, HostNotSupportedError _LOGGER = logging.getLogger(__name__) -UNKNOWN = 'Unknown' - class InfoCenter(CoreSysAttributes): """Handle local system information controls.""" @@ -20,27 +18,32 @@ class InfoCenter(CoreSysAttributes): @property def hostname(self): """Return local hostname.""" - return self._data.get('Hostname', UNKNOWN) + return self._data.get('Hostname') or None @property def chassis(self): """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 def kernel(self): """Return local kernel version.""" - return self._data.get('KernelRelease', UNKNOWN) + return self._data.get('KernelRelease') or None @property def operating_system(self): """Return local operating system.""" - return self._data.get('OperatingSystemPrettyName', UNKNOWN) + return self._data.get('OperatingSystemPrettyName') or None @property def cpe(self): """Return local CPE.""" - return self._data.get('OperatingSystemCPEName', UNKNOWN) + return self._data.get('OperatingSystemCPEName') or None async def update(self): """Update properties over dbus."""