diff --git a/homeassistant/components/group/light.py b/homeassistant/components/group/light.py index 84c218b5d72..4357085ef8a 100644 --- a/homeassistant/components/group/light.py +++ b/homeassistant/components/group/light.py @@ -371,6 +371,10 @@ class LightGroup(GroupEntity, light.LightEntity): if all_effect_lists: # Merge all effects from all effect_lists with a union merge. self._effect_list = list(set().union(*all_effect_lists)) + self._effect_list.sort() + if "None" in self._effect_list: + self._effect_list.remove("None") + self._effect_list.insert(0, "None") self._effect = None all_effects = list(_find_state_attributes(on_states, ATTR_EFFECT)) diff --git a/tests/components/group/test_light.py b/tests/components/group/test_light.py index c9b861a46a9..b409786dc07 100644 --- a/tests/components/group/test_light.py +++ b/tests/components/group/test_light.py @@ -656,6 +656,10 @@ async def test_effect_list(hass): await hass.async_block_till_done() state = hass.states.get("light.light_group") assert set(state.attributes[ATTR_EFFECT_LIST]) == {"None", "Random", "Colorloop"} + # These ensure the output is sorted as expected + assert state.attributes[ATTR_EFFECT_LIST][0] == "None" + assert state.attributes[ATTR_EFFECT_LIST][1] == "Colorloop" + assert state.attributes[ATTR_EFFECT_LIST][2] == "Random" hass.states.async_set( "light.test2",