1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Remove service helper (6) (#16920)

* Update automation

* Update group

* Async_create_task
This commit is contained in:
cdce8p
2018-09-27 23:14:09 +02:00
committed by Paulus Schoutsen
parent 70b901017f
commit f879ac0993
7 changed files with 95 additions and 97 deletions

View File

@@ -3,10 +3,9 @@ import asyncio
from collections import OrderedDict
import uuid
from homeassistant.const import CONF_ID
from homeassistant.components.config import EditIdBasedConfigView
from homeassistant.components.automation import (
PLATFORM_SCHEMA, DOMAIN, async_reload)
from homeassistant.const import CONF_ID, SERVICE_RELOAD
from homeassistant.components.automation import DOMAIN, PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
@@ -16,9 +15,13 @@ CONFIG_PATH = 'automations.yaml'
@asyncio.coroutine
def async_setup(hass):
"""Set up the Automation config API."""
async def hook(hass):
"""post_write_hook for Config View that reloads automations."""
await hass.services.async_call(DOMAIN, SERVICE_RELOAD)
hass.http.register_view(EditAutomationConfigView(
DOMAIN, 'config', CONFIG_PATH, cv.string,
PLATFORM_SCHEMA, post_write_hook=async_reload
PLATFORM_SCHEMA, post_write_hook=hook
))
return True