From 217c1acc62211c4f2e7e20e6296d56616100f13f Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 26 Apr 2018 11:27:02 +0200 Subject: [PATCH] Update and rename power.py to control.py --- hassio/host/{power.py => control.py} | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) rename hassio/host/{power.py => control.py} (79%) diff --git a/hassio/host/power.py b/hassio/host/control.py similarity index 79% rename from hassio/host/power.py rename to hassio/host/control.py index f620e15b2..b17f8da84 100644 --- a/hassio/host/power.py +++ b/hassio/host/control.py @@ -7,7 +7,7 @@ from ..exceptions import HostNotSupportedError _LOGGER = logging.getLogger(__name__) -class PowerControl(CoreSysAttributes): +class SystemControl(CoreSysAttributes): """Handle host power controls.""" def __init__(self, coresys): @@ -39,3 +39,9 @@ class PowerControl(CoreSysAttributes): await self.sys_core.shutdown() finally: await self.sys_dbus.systemd.power_off() + + async def set_hostname(self, hostname): + """Set local a new Hostname.""" + _LOGGER.info("Set Hostname %s", hostname) + await self.sys_dbus.hostname.set_hostname(hostname) + await self.sys_host.info.update()