mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 13:16:29 +00:00
shield host functions
This commit is contained in:
parent
dc77e2d8d9
commit
7c6bf96f6f
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user