mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 15:08:10 +01:00
Nextion allow underscore on names (#5979)
This commit is contained in:
parent
74281b93c4
commit
5e2df0b6a2
1 changed files with 2 additions and 2 deletions
|
@ -33,14 +33,14 @@ CONF_EXIT_REPARSE_ON_START = "exit_reparse_on_start"
|
||||||
|
|
||||||
|
|
||||||
def NextionName(value):
|
def NextionName(value):
|
||||||
valid_chars = f"{ascii_letters + digits}."
|
valid_chars = f"{ascii_letters + digits + '_'}."
|
||||||
if not isinstance(value, str) or len(value) > 29:
|
if not isinstance(value, str) or len(value) > 29:
|
||||||
raise cv.Invalid("Must be a string less than 29 characters")
|
raise cv.Invalid("Must be a string less than 29 characters")
|
||||||
|
|
||||||
for char in value:
|
for char in value:
|
||||||
if char not in valid_chars:
|
if char not in valid_chars:
|
||||||
raise cv.Invalid(
|
raise cv.Invalid(
|
||||||
f"Must only consist of upper/lowercase characters, numbers and the period '.'. The character '{char}' cannot be used."
|
f"Must only consist of upper/lowercase characters, numbers, the underscore '_', and the period '.'. The character '{char}' cannot be used."
|
||||||
)
|
)
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in a new issue