This commit is contained in:
Paulus Schoutsen 2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View file

@ -5,17 +5,24 @@ import homeassistant.helpers.config_validation as cv
from . import EditKeyBasedConfigView
CONFIG_PATH = 'scripts.yaml'
CONFIG_PATH = "scripts.yaml"
async def async_setup(hass):
"""Set up the script config API."""
async def hook(hass):
"""post_write_hook for Config View that reloads scripts."""
await hass.services.async_call(DOMAIN, SERVICE_RELOAD)
hass.http.register_view(EditKeyBasedConfigView(
'script', 'config', CONFIG_PATH, cv.slug, SCRIPT_ENTRY_SCHEMA,
post_write_hook=hook
))
hass.http.register_view(
EditKeyBasedConfigView(
"script",
"config",
CONFIG_PATH,
cv.slug,
SCRIPT_ENTRY_SCHEMA,
post_write_hook=hook,
)
)
return True