Sort entities in default groups by name (#7681)
* Sort entities in default groups by name * Cleanups from review
This commit is contained in:
parent
b3cb057aac
commit
bb8de5845a
2 changed files with 8 additions and 7 deletions
|
@ -232,12 +232,12 @@ class EntityComponent(object):
|
|||
if self.group is None and self.group_name is not None:
|
||||
group = get_component('group')
|
||||
self.group = yield from group.Group.async_create_group(
|
||||
self.hass, self.group_name, self.entities.keys(),
|
||||
user_defined=False
|
||||
)
|
||||
self.hass, self.group_name,
|
||||
sorted(self.entities, key=lambda x: self.entities[x].name),
|
||||
user_defined=False)
|
||||
elif self.group is not None:
|
||||
yield from self.group.async_update_tracked_entity_ids(
|
||||
self.entities.keys())
|
||||
sorted(self.entities, key=lambda x: self.entities[x].name))
|
||||
|
||||
def reset(self):
|
||||
"""Remove entities and reset the entity component to initial values."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue