Update and rename power.py to control.py

This commit is contained in:
Pascal Vizeli 2018-04-26 11:27:02 +02:00 committed by GitHub
parent 2c0a68bd8f
commit 217c1acc62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ from ..exceptions import HostNotSupportedError
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
class PowerControl(CoreSysAttributes): class SystemControl(CoreSysAttributes):
"""Handle host power controls.""" """Handle host power controls."""
def __init__(self, coresys): def __init__(self, coresys):
@ -39,3 +39,9 @@ class PowerControl(CoreSysAttributes):
await self.sys_core.shutdown() await self.sys_core.shutdown()
finally: finally:
await self.sys_dbus.systemd.power_off() 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()