shield host functions

This commit is contained in:
Pascal Vizeli 2018-05-03 01:00:13 +02:00 committed by GitHub
parent dc77e2d8d9
commit 7c6bf96f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
"""Init file for HassIO host rest api."""
import asyncio
import logging
import voluptuous as vol
@ -45,22 +46,23 @@ class APIHost(CoreSysAttributes):
# hostname
if ATTR_HOSTNAME in body:
await self.sys_host.control.set_hostname(body[ATTR_HOSTNAME])
await asyncio.shield(
self.sys_host.control.set_hostname(body[ATTR_HOSTNAME]))
@api_process
def reboot(self, request):
"""Reboot host."""
return self.sys_host.control.reboot()
return asyncio.shield(self.sys_host.control.reboot())
@api_process
def shutdown(self, request):
"""Poweroff host."""
return self.sys_host.control.shutdown()
return asyncio.shield(self.sys_host.control.shutdown())
@api_process
def reload(self, request):
"""Reload host data."""
return self.sys_host.reload()
return asyncio.shield(self.sys_host.reload())
@api_process
async def update(self, request):