Fix EntityComponent handle entities without a name (#8065)

* Fix EntityComponent handle entities without a name

* Implement solution by Anders
This commit is contained in:
Paulus Schoutsen committed 2017-06-17 10:59:18 -07:00
1 parent 9fc22ee47a
commit 363a429c41
2 files changed
+7 -5

No files matched your search

+5 -4
View File
@@ -84,7 +84,7 @@ class TestHelpersEntityComponent(unittest.TestCase):
# No group after setup
assert len(self.hass.states.entity_ids()) == 0
component.add_entities([EntityTest(name='hello')])
component.add_entities([EntityTest()])
# group exists
assert len(self.hass.states.entity_ids()) == 2
@@ -92,7 +92,8 @@ class TestHelpersEntityComponent(unittest.TestCase):
group = self.hass.states.get('group.everyone')
assert group.attributes.get('entity_id') == ('test_domain.hello',)
assert group.attributes.get('entity_id') == \
('test_domain.unnamed_device',)
# group extended
component.add_entities([EntityTest(name='goodbye')])
@@ -100,9 +101,9 @@ class TestHelpersEntityComponent(unittest.TestCase):
assert len(self.hass.states.entity_ids()) == 3
group = self.hass.states.get('group.everyone')
# Sorted order
# Ordered in order of added to the group
assert group.attributes.get('entity_id') == \
('test_domain.goodbye', 'test_domain.hello')
('test_domain.goodbye', 'test_domain.unnamed_device')
def test_polling_only_updates_entities_it_should_poll(self):
"""Test the polling of only updated entities."""