1 """Provide configuration end points for scripts."""
3 from __future__
import annotations
14 from .const
import ACTION_DELETE
15 from .view
import EditKeyBasedConfigView
20 """Set up the script config API."""
22 async
def hook(action: str, config_key: str) ->
None:
23 """post_write_hook for Config View that reloads scripts."""
24 if action != ACTION_DELETE:
25 await hass.services.async_call(SCRIPT_DOMAIN, SERVICE_RELOAD)
28 ent_reg = er.async_get(hass)
30 entity_id = ent_reg.async_get_entity_id(
31 SCRIPT_DOMAIN, SCRIPT_DOMAIN, config_key
37 ent_reg.async_remove(entity_id)
39 hass.http.register_view(
46 data_validator=async_validate_config_item,
53 """Edit script config."""
58 data: dict[str, dict[str, Any]],
60 new_value: dict[str, Any],
63 data[config_key] = new_value
None _write_value(self, HomeAssistant hass, dict[str, dict[str, Any]] data, str config_key, dict[str, Any] new_value)
bool async_setup(HomeAssistant hass)