From 64fff480211d99bd4b9223662b57dd222ed8ae72 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 30 Aug 2015 20:44:38 -0700 Subject: [PATCH] Allow spaces in group setup string --- homeassistant/components/group.py | 2 +- tests/components/test_group.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/group.py b/homeassistant/components/group.py index 1d307baaca9..09a3ff97634 100644 --- a/homeassistant/components/group.py +++ b/homeassistant/components/group.py @@ -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 diff --git a/tests/components/test_group.py b/tests/components/test_group.py index d66a24606a3..d7ed7f105d0 100644 --- a/tests/components/test_group.py +++ b/tests/components/test_group.py @@ -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):