From f73bda1218f85d1860ab17f05f0bdc9d8f2ad440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Wed, 9 Jan 2019 05:08:20 +0100 Subject: [PATCH] Allow other icon prefixes than mdi: (#19872) --- homeassistant/helpers/config_validation.py | 4 ++-- tests/helpers/test_config_validation.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index c14f4e4fadb..245cc5d46bd 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -200,10 +200,10 @@ def icon(value): """Validate icon.""" value = str(value) - if value.startswith('mdi:'): + if ':' in value: return value - raise vol.Invalid('Icons should start with prefix "mdi:"') + raise vol.Invalid('Icons should be specifed on the form "prefix:name"') time_period_dict = vol.All( diff --git a/tests/helpers/test_config_validation.py b/tests/helpers/test_config_validation.py index 412882f0a01..791570981e2 100644 --- a/tests/helpers/test_config_validation.py +++ b/tests/helpers/test_config_validation.py @@ -258,11 +258,12 @@ def test_icon(): """Test icon validation.""" schema = vol.Schema(cv.icon) - for value in (False, 'work', 'icon:work'): + for value in (False, 'work'): with pytest.raises(vol.MultipleInvalid): schema(value) schema('mdi:work') + schema('custom:prefix') def test_time_period():