mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Hide groups when they are views or auto defined
This commit is contained in:
parent
4abc5c97cd
commit
6c91831baa
@ -1 +1 @@
|
||||
Subproject commit 83ac27db0f7e4a9ae2499130be13940d7b5a030f
|
||||
Subproject commit c3337e893277ce677ba4eea3ac4646d66ee3522b
|
@ -167,6 +167,10 @@ class Group(Entity):
|
||||
def icon(self):
|
||||
return self._icon
|
||||
|
||||
@property
|
||||
def hidden(self):
|
||||
return not self._user_defined or self._view
|
||||
|
||||
@property
|
||||
def state_attributes(self):
|
||||
data = {
|
||||
|
@ -10,7 +10,7 @@ import logging
|
||||
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.const import (
|
||||
STATE_ON, STATE_OFF, STATE_HOME, STATE_UNKNOWN, ATTR_ICON)
|
||||
STATE_ON, STATE_OFF, STATE_HOME, STATE_UNKNOWN, ATTR_ICON, ATTR_HIDDEN)
|
||||
import homeassistant.components.group as group
|
||||
|
||||
|
||||
@ -217,8 +217,8 @@ class TestComponentsGroup(unittest.TestCase):
|
||||
self.assertIsNone(group_state.attributes.get(group.ATTR_AUTO))
|
||||
self.assertEqual('mdi:work',
|
||||
group_state.attributes.get(ATTR_ICON))
|
||||
self.assertEqual(True,
|
||||
group_state.attributes.get(group.ATTR_VIEW))
|
||||
self.assertTrue(group_state.attributes.get(group.ATTR_VIEW))
|
||||
self.assertTrue(group_state.attributes.get(ATTR_HIDDEN))
|
||||
|
||||
group_state = self.hass.states.get(
|
||||
group.ENTITY_ID_FORMAT.format('test_group'))
|
||||
@ -228,6 +228,7 @@ class TestComponentsGroup(unittest.TestCase):
|
||||
self.assertIsNone(group_state.attributes.get(group.ATTR_AUTO))
|
||||
self.assertIsNone(group_state.attributes.get(ATTR_ICON))
|
||||
self.assertIsNone(group_state.attributes.get(group.ATTR_VIEW))
|
||||
self.assertIsNone(group_state.attributes.get(ATTR_HIDDEN))
|
||||
|
||||
def test_groups_get_unique_names(self):
|
||||
""" Two groups with same name should both have a unique entity id. """
|
||||
|
Loading…
x
Reference in New Issue
Block a user