mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-22 16:46:29 +00:00
Update and rename local.py to info.py
This commit is contained in:
parent
e37ffd6107
commit
2c0a68bd8f
@ -9,7 +9,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
UNKNOWN = 'Unknown'
|
UNKNOWN = 'Unknown'
|
||||||
|
|
||||||
|
|
||||||
class LocalCenter(CoreSysAttributes):
|
class InfoCenter(CoreSysAttributes):
|
||||||
"""Handle local system information controls."""
|
"""Handle local system information controls."""
|
||||||
|
|
||||||
def __init__(self, coresys):
|
def __init__(self, coresys):
|
||||||
@ -42,7 +42,7 @@ class LocalCenter(CoreSysAttributes):
|
|||||||
"""Return local CPE."""
|
"""Return local CPE."""
|
||||||
return self._data.get('OperatingSystemCPEName', UNKNOWN)
|
return self._data.get('OperatingSystemCPEName', UNKNOWN)
|
||||||
|
|
||||||
def _check_dbus(self):
|
def _check_dbus_hostname(self):
|
||||||
"""Check if systemd is connect or raise error."""
|
"""Check if systemd is connect or raise error."""
|
||||||
if not self.sys_dbus.hostname.is_connected:
|
if not self.sys_dbus.hostname.is_connected:
|
||||||
_LOGGER.error("No hostname dbus connection available")
|
_LOGGER.error("No hostname dbus connection available")
|
||||||
@ -50,18 +50,10 @@ class LocalCenter(CoreSysAttributes):
|
|||||||
|
|
||||||
async def update(self):
|
async def update(self):
|
||||||
"""Update properties over dbus."""
|
"""Update properties over dbus."""
|
||||||
self._check_dbus()
|
self._check_dbus_hostname()
|
||||||
|
|
||||||
_LOGGER.info("Update local host information")
|
_LOGGER.info("Update local host information")
|
||||||
try:
|
try:
|
||||||
self._data = await self.sys_dbus.hostname.get_properties()
|
self._data = await self.sys_dbus.hostname.get_properties()
|
||||||
except HassioError:
|
except HassioError:
|
||||||
_LOGGER.warning("Can't update host system information!")
|
_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()
|
|
Loading…
x
Reference in New Issue
Block a user