1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Validate device action schemas once (#48351)

This commit is contained in:
Erik Montnemery 2021-03-26 08:46:26 +01:00 committed by GitHub
parent 5b17aaf9d5
commit 4fbc3da196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 0 additions and 24 deletions

View File

@ -112,8 +112,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if CONF_CODE in config:
service_data[ATTR_CODE] = config[CONF_CODE]

View File

@ -79,8 +79,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if config[CONF_TYPE] == "set_hvac_mode":

View File

@ -165,8 +165,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if config[CONF_TYPE] == "open":

View File

@ -62,8 +62,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if config[CONF_TYPE] == "turn_on":

View File

@ -82,8 +82,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if config[CONF_TYPE] == "set_humidity":

View File

@ -78,8 +78,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if config[CONF_TYPE] == "lock":

View File

@ -55,11 +55,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
if config[CONF_TYPE] != ATYP_SET_VALUE:
return
await hass.services.async_call(
DOMAIN,
const.SERVICE_SET_VALUE,
@ -74,11 +69,6 @@ async def async_call_action_from_config(
async def async_get_action_capabilities(hass: HomeAssistant, config: dict) -> dict:
"""List action capabilities."""
action_type = config[CONF_TYPE]
if action_type != ATYP_SET_VALUE:
return {}
fields = {vol.Required(const.ATTR_VALUE): vol.Coerce(float)}
return {"extra_fields": vol.Schema(fields)}

View File

@ -61,8 +61,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if config[CONF_TYPE] == "turn_on":