diff --git a/homeassistant/components/group/cover.py b/homeassistant/components/group/cover.py index 0832d466f8c..2638ce072a3 100644 --- a/homeassistant/components/group/cover.py +++ b/homeassistant/components/group/cover.py @@ -200,6 +200,11 @@ class CoverGroup(CoverEntity): """Return current tilt position for all covers.""" return self._tilt_position + @property + def device_state_attributes(self): + """Return the state attributes for the cover group.""" + return {ATTR_ENTITY_ID: self._entities} + async def async_open_cover(self, **kwargs): """Move the covers up.""" data = {ATTR_ENTITY_ID: self._covers[KEY_OPEN_CLOSE]} diff --git a/homeassistant/components/group/light.py b/homeassistant/components/group/light.py index 56408f410b8..1136df7eac0 100644 --- a/homeassistant/components/group/light.py +++ b/homeassistant/components/group/light.py @@ -183,6 +183,11 @@ class LightGroup(light.LightEntity): """No polling needed for a light group.""" return False + @property + def device_state_attributes(self): + """Return the state attributes for the light group.""" + return {ATTR_ENTITY_ID: self._entity_ids} + async def async_turn_on(self, **kwargs): """Forward the turn_on command to all lights in the light group.""" data = {ATTR_ENTITY_ID: self._entity_ids} diff --git a/tests/components/group/test_cover.py b/tests/components/group/test_cover.py index 1adad3e3d85..98460762389 100644 --- a/tests/components/group/test_cover.py +++ b/tests/components/group/test_cover.py @@ -86,6 +86,12 @@ async def test_attributes(hass, setup_comp): state = hass.states.get(COVER_GROUP) assert state.state == STATE_CLOSED assert state.attributes[ATTR_FRIENDLY_NAME] == DEFAULT_NAME + assert state.attributes[ATTR_ENTITY_ID] == [ + DEMO_COVER, + DEMO_COVER_POS, + DEMO_COVER_TILT, + DEMO_TILT, + ] assert ATTR_ASSUMED_STATE not in state.attributes assert state.attributes[ATTR_SUPPORTED_FEATURES] == 0 assert ATTR_CURRENT_POSITION not in state.attributes diff --git a/tests/components/group/test_light.py b/tests/components/group/test_light.py index 70dab4472ed..1f68279ae05 100644 --- a/tests/components/group/test_light.py +++ b/tests/components/group/test_light.py @@ -34,17 +34,25 @@ from tests.async_mock import MagicMock async def test_default_state(hass): """Test light group default state.""" + hass.states.async_set("light.kitchen", "on") await async_setup_component( hass, LIGHT_DOMAIN, - {LIGHT_DOMAIN: {"platform": DOMAIN, "entities": [], "name": "Bedroom Group"}}, + { + LIGHT_DOMAIN: { + "platform": DOMAIN, + "entities": ["light.kitchen", "light.bedroom"], + "name": "Bedroom Group", + } + }, ) await hass.async_block_till_done() state = hass.states.get("light.bedroom_group") assert state is not None - assert state.state == STATE_UNAVAILABLE + assert state.state == STATE_ON assert state.attributes[ATTR_SUPPORTED_FEATURES] == 0 + assert state.attributes.get(ATTR_ENTITY_ID) == ["light.kitchen", "light.bedroom"] assert state.attributes.get(ATTR_BRIGHTNESS) is None assert state.attributes.get(ATTR_HS_COLOR) is None assert state.attributes.get(ATTR_COLOR_TEMP) is None