Add alias to DOMAIN import in config and demo (#125570)
This commit is contained in:
parent
7e2e3c4780
commit
2fa0f283ea
4 changed files with 22 additions and 14 deletions
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.script import DOMAIN
|
||||
from homeassistant.components.script import DOMAIN as SCRIPT_DOMAIN
|
||||
from homeassistant.components.script.config import (
|
||||
SCRIPT_ENTITY_SCHEMA,
|
||||
async_validate_config_item,
|
||||
|
@ -25,12 +25,14 @@ def async_setup(hass: HomeAssistant) -> bool:
|
|||
async def hook(action: str, config_key: str) -> None:
|
||||
"""post_write_hook for Config View that reloads scripts."""
|
||||
if action != ACTION_DELETE:
|
||||
await hass.services.async_call(DOMAIN, SERVICE_RELOAD)
|
||||
await hass.services.async_call(SCRIPT_DOMAIN, SERVICE_RELOAD)
|
||||
return
|
||||
|
||||
ent_reg = er.async_get(hass)
|
||||
|
||||
entity_id = ent_reg.async_get_entity_id(DOMAIN, DOMAIN, config_key)
|
||||
entity_id = ent_reg.async_get_entity_id(
|
||||
SCRIPT_DOMAIN, SCRIPT_DOMAIN, config_key
|
||||
)
|
||||
|
||||
if entity_id is None:
|
||||
return
|
||||
|
@ -39,7 +41,7 @@ def async_setup(hass: HomeAssistant) -> bool:
|
|||
|
||||
hass.http.register_view(
|
||||
EditScriptConfigView(
|
||||
DOMAIN,
|
||||
SCRIPT_DOMAIN,
|
||||
"config",
|
||||
SCRIPT_CONFIG_PATH,
|
||||
cv.slug,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue