mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Sort effect lists in light groups (#50620)
This commit is contained in:
parent
e32dc306e1
commit
7221b1e09d
@ -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))
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user