mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix typo in Template switch (#121856)
This commit is contained in:
parent
df85067cae
commit
62b9b34561
@ -60,7 +60,7 @@ PLATFORM_SCHEMA = SWITCH_PLATFORM_SCHEMA.extend(
|
|||||||
{vol.Required(CONF_SWITCHES): cv.schema_with_slug_keys(SWITCH_SCHEMA)}
|
{vol.Required(CONF_SWITCHES): cv.schema_with_slug_keys(SWITCH_SCHEMA)}
|
||||||
)
|
)
|
||||||
|
|
||||||
SWICTH_CONFIG_SCHEMA = vol.Schema(
|
SWITCH_CONFIG_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(CONF_NAME): cv.template,
|
vol.Required(CONF_NAME): cv.template,
|
||||||
vol.Optional(CONF_VALUE_TEMPLATE): cv.template,
|
vol.Optional(CONF_VALUE_TEMPLATE): cv.template,
|
||||||
@ -109,7 +109,7 @@ async def async_setup_entry(
|
|||||||
"""Initialize config entry."""
|
"""Initialize config entry."""
|
||||||
_options = dict(config_entry.options)
|
_options = dict(config_entry.options)
|
||||||
_options.pop("template_type")
|
_options.pop("template_type")
|
||||||
validated_config = SWICTH_CONFIG_SCHEMA(_options)
|
validated_config = SWITCH_CONFIG_SCHEMA(_options)
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
[SwitchTemplate(hass, None, validated_config, config_entry.entry_id)]
|
[SwitchTemplate(hass, None, validated_config, config_entry.entry_id)]
|
||||||
)
|
)
|
||||||
@ -120,7 +120,7 @@ def async_create_preview_switch(
|
|||||||
hass: HomeAssistant, name: str, config: dict[str, Any]
|
hass: HomeAssistant, name: str, config: dict[str, Any]
|
||||||
) -> SwitchTemplate:
|
) -> SwitchTemplate:
|
||||||
"""Create a preview switch."""
|
"""Create a preview switch."""
|
||||||
validated_config = SWICTH_CONFIG_SCHEMA(config | {CONF_NAME: name})
|
validated_config = SWITCH_CONFIG_SCHEMA(config | {CONF_NAME: name})
|
||||||
return SwitchTemplate(hass, None, validated_config, None)
|
return SwitchTemplate(hass, None, validated_config, None)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user