Add service to change visibility of a group (#3998)

This commit is contained in:
Pierre Ståhl authored and Paulus Schoutsen committed 2016-10-29 16:54:26 -07:00
1 parent 3f6a5564ad
commit 33e46b484f
7 files changed
+106 -9

No files matched your search

+20
View File
@@ -352,3 +352,23 @@ class TestComponentsGroup(unittest.TestCase):
assert self.hass.states.entity_ids() == ['group.light']
grp.stop()
assert self.hass.states.entity_ids() == []
def test_changing_group_visibility(self):
"""Test that a group can be hidden and shown."""
setup_component(self.hass, 'group', {
'group': {
'test_group': 'hello.world,sensor.happy'
}
})
group_entity_id = group.ENTITY_ID_FORMAT.format('test_group')
# Hide the group
group.set_visibility(self.hass, group_entity_id, False)
group_state = self.hass.states.get(group_entity_id)
self.assertTrue(group_state.attributes.get(ATTR_HIDDEN))
# Show it again
group.set_visibility(self.hass, group_entity_id, True)
group_state = self.hass.states.get(group_entity_id)
self.assertIsNone(group_state.attributes.get(ATTR_HIDDEN))