mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 22:53:59 +00:00
Fix substitutions
This commit is contained in:
@@ -19,10 +19,10 @@ def validate_substitution_key(value):
|
|||||||
value = cv.string(value)
|
value = cv.string(value)
|
||||||
if not value:
|
if not value:
|
||||||
raise vol.Invalid("Substitution key must not be empty")
|
raise vol.Invalid("Substitution key must not be empty")
|
||||||
if value[0].isdigit():
|
|
||||||
raise vol.Invalid("First character in substitutions cannot be a digit.")
|
|
||||||
if value[0] == '$':
|
if value[0] == '$':
|
||||||
value = value[1:]
|
value = value[1:]
|
||||||
|
if value[0].isdigit():
|
||||||
|
raise vol.Invalid("First character in substitutions cannot be a digit.")
|
||||||
for char in value:
|
for char in value:
|
||||||
if char not in VALID_SUBSTITUTIONS_CHARACTERS:
|
if char not in VALID_SUBSTITUTIONS_CHARACTERS:
|
||||||
raise vol.Invalid(
|
raise vol.Invalid(
|
||||||
|
|||||||
Reference in New Issue
Block a user