1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 05:12:21 +01:00

Relax the icon validator to allow non-mdi icons (#2764)

This commit is contained in:
Paul Monigatti
2021-11-23 21:21:14 +13:00
committed by GitHub
parent 710096b1c6
commit 05fe5db030
2 changed files with 6 additions and 4 deletions

View File

@@ -296,9 +296,11 @@ def icon(value):
value = string_strict(value)
if not value:
return value
if value.startswith("mdi:"):
if re.match("^[\\w\\-]+:[\\w\\-]+$", value):
return value
raise Invalid('Icons should start with prefix "mdi:"')
raise Invalid(
'Icons must match the format "[icon pack]:[icon]", e.g. "mdi:home-assistant"'
)
def boolean(value):