Allow spaces in group setup string

This commit is contained in:
Paulus Schoutsen 2015-08-30 20:44:38 -07:00
parent 98b0367249
commit 64fff48021
2 changed files with 4 additions and 2 deletions

View File

@ -104,7 +104,7 @@ def setup(hass, config):
""" Sets up all groups found definded in the configuration. """
for name, entity_ids in config.get(DOMAIN, {}).items():
if isinstance(entity_ids, str):
entity_ids = entity_ids.split(",")
entity_ids = [ent.strip() for ent in entity_ids.split(",")]
setup_group(hass, name, entity_ids)
return True

View File

@ -199,7 +199,7 @@ class TestComponentsGroup(unittest.TestCase):
self.hass,
{
group.DOMAIN: {
'second_group': self.group_entity_id + ',light.Bowl'
'second_group': 'light.Bowl, ' + self.group_entity_id
}
}))
@ -207,6 +207,8 @@ class TestComponentsGroup(unittest.TestCase):
group.ENTITY_ID_FORMAT.format('second_group'))
self.assertEqual(STATE_ON, group_state.state)
self.assertEqual(set((self.group_entity_id, 'light.bowl')),
set(group_state.attributes['entity_id']))
self.assertFalse(group_state.attributes[group.ATTR_AUTO])
def test_groups_get_unique_names(self):