From 2c0a68bd8fe64a7bb5e9cee3584401efc3cec21c Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 26 Apr 2018 09:44:49 +0200 Subject: [PATCH] Update and rename local.py to info.py --- hassio/host/{local.py => info.py} | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) rename hassio/host/{local.py => info.py} (82%) diff --git a/hassio/host/local.py b/hassio/host/info.py similarity index 82% rename from hassio/host/local.py rename to hassio/host/info.py index ab41be753..76b794b0f 100644 --- a/hassio/host/local.py +++ b/hassio/host/info.py @@ -9,7 +9,7 @@ _LOGGER = logging.getLogger(__name__) UNKNOWN = 'Unknown' -class LocalCenter(CoreSysAttributes): +class InfoCenter(CoreSysAttributes): """Handle local system information controls.""" def __init__(self, coresys): @@ -42,7 +42,7 @@ class LocalCenter(CoreSysAttributes): """Return local CPE.""" return self._data.get('OperatingSystemCPEName', UNKNOWN) - def _check_dbus(self): + def _check_dbus_hostname(self): """Check if systemd is connect or raise error.""" if not self.sys_dbus.hostname.is_connected: _LOGGER.error("No hostname dbus connection available") @@ -50,18 +50,10 @@ class LocalCenter(CoreSysAttributes): async def update(self): """Update properties over dbus.""" - self._check_dbus() + self._check_dbus_hostname() _LOGGER.info("Update local host information") try: self._data = await self.sys_dbus.hostname.get_properties() except HassioError: _LOGGER.warning("Can't update host system information!") - - async def set_hostname(self, hostname): - """Set local a new Hostname.""" - self._check_dbus() - - _LOGGER.info("Set Hostname %s", hostname) - await self.sys_dbus.hostname.set_hostname(hostname) - await self.update()