From 84f506efb719b16d5bf441a44b2e85d863117069 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Fri, 29 Jan 2021 21:11:12 +0100 Subject: [PATCH] Set default position value for cover action (#45670) Co-authored-by: Bram Kragten Co-authored-by: Franck Nijhof --- homeassistant/components/cover/device_action.py | 4 +++- homeassistant/helpers/config_validation.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/cover/device_action.py b/homeassistant/components/cover/device_action.py index 29dd97909e3..490ce162d9a 100644 --- a/homeassistant/components/cover/device_action.py +++ b/homeassistant/components/cover/device_action.py @@ -49,7 +49,9 @@ POSITION_ACTION_SCHEMA = cv.DEVICE_ACTION_BASE_SCHEMA.extend( { vol.Required(CONF_TYPE): vol.In(POSITION_ACTION_TYPES), vol.Required(CONF_ENTITY_ID): cv.entity_domain(DOMAIN), - vol.Required("position"): vol.All(vol.Coerce(int), vol.Range(min=0, max=100)), + vol.Optional("position", default=0): vol.All( + vol.Coerce(int), vol.Range(min=0, max=100) + ), } ) diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index acf6139708a..d47ba30c114 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -266,7 +266,7 @@ def entity_id(value: Any) -> str: if valid_entity_id(str_value): return str_value - raise vol.Invalid(f"Entity ID {value} is an invalid entity id") + raise vol.Invalid(f"Entity ID {value} is an invalid entity ID") def entity_ids(value: Union[str, List]) -> List[str]: