Bugfix invalid entity_config parameter HomeKit (#17143)
This commit is contained in:
parent
769dda735d
commit
52ff232797
2 changed files with 5 additions and 1 deletions
|
@ -44,6 +44,9 @@ SWITCH_TYPE_SCHEMA = BASIC_INFO_SCHEMA.extend({
|
||||||
|
|
||||||
def validate_entity_config(values):
|
def validate_entity_config(values):
|
||||||
"""Validate config entry for CONF_ENTITY."""
|
"""Validate config entry for CONF_ENTITY."""
|
||||||
|
if not isinstance(values, dict):
|
||||||
|
raise vol.Invalid('expected a dictionary')
|
||||||
|
|
||||||
entities = {}
|
entities = {}
|
||||||
for entity_id, config in values.items():
|
for entity_id, config in values.items():
|
||||||
entity = cv.entity_id(entity_id)
|
entity = cv.entity_id(entity_id)
|
||||||
|
|
|
@ -23,7 +23,8 @@ from tests.common import async_mock_service
|
||||||
|
|
||||||
def test_validate_entity_config():
|
def test_validate_entity_config():
|
||||||
"""Test validate entities."""
|
"""Test validate entities."""
|
||||||
configs = [{'invalid_entity_id': {}}, {'demo.test': 1},
|
configs = [None, [], 'string', 12345,
|
||||||
|
{'invalid_entity_id': {}}, {'demo.test': 1},
|
||||||
{'demo.test': 'test'}, {'demo.test': [1, 2]},
|
{'demo.test': 'test'}, {'demo.test': [1, 2]},
|
||||||
{'demo.test': None}, {'demo.test': {CONF_NAME: None}},
|
{'demo.test': None}, {'demo.test': {CONF_NAME: None}},
|
||||||
{'media_player.test': {CONF_FEATURE_LIST: [
|
{'media_player.test': {CONF_FEATURE_LIST: [
|
||||||
|
|
Loading…
Add table
Reference in a new issue