mirror of
https://github.com/home-assistant/core.git
synced 2026-12-03 04:08:19 -04:00
Use a local config key in the text device action (#195442)
This commit is contained in:
@@ -14,15 +14,16 @@ from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
||||
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
|
||||
|
||||
from .const import ATTR_VALUE, DOMAIN, TextService, TextServiceArgument
|
||||
from .const import DOMAIN, TextService, TextServiceArgument
|
||||
|
||||
CONF_VALUE = "value"
|
||||
ATYP_SET_VALUE = "set_value"
|
||||
|
||||
_ACTION_SCHEMA = cv.DEVICE_ACTION_BASE_SCHEMA.extend(
|
||||
{
|
||||
probatio.Required(CONF_TYPE): ATYP_SET_VALUE,
|
||||
probatio.Required(CONF_ENTITY_ID): cv.entity_id_or_uuid,
|
||||
probatio.Required(ATTR_VALUE): cv.string,
|
||||
probatio.Required(CONF_VALUE): cv.string,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -70,7 +71,7 @@ async def async_call_action_from_config(
|
||||
TextService.SET_VALUE,
|
||||
{
|
||||
TargetKey.ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
TextServiceArgument.VALUE: config[ATTR_VALUE],
|
||||
TextServiceArgument.VALUE: config[CONF_VALUE],
|
||||
},
|
||||
blocking=True,
|
||||
context=context,
|
||||
@@ -81,6 +82,6 @@ async def async_get_action_capabilities(
|
||||
hass: HomeAssistant, config: ConfigType
|
||||
) -> dict[str, probatio.Schema]:
|
||||
"""List action capabilities."""
|
||||
fields = {probatio.Required(ATTR_VALUE): cv.string}
|
||||
fields = {probatio.Required(CONF_VALUE): cv.string}
|
||||
|
||||
return {"extra_fields": probatio.Schema(fields)}
|
||||
|
||||
Reference in New Issue
Block a user