Frontend Group Order Control

This is probably an old issue but I have not seen a resolution in the Groups documentation.
I was hoping that, if I put everything in groups, then they would be displayed in the order given in the entities list.

default_view: view: True icon: mdi:home entities: - group.alarms - group.lights - group.back_door_lock - group.temperature_control
Instead, the order displayed in Chrome and IOS is

`- group.back_door_lock

  • group.temperature_control
  • group.alarms
  • group.lights`

I am at v0.46.0
Seems like a reasonable expectation. What am I missing?

I believe they appear in the order that they are defined.

So in your groups code you probably have:

default_view:
view: True 
icon: mdi:home
entities:
- group.alarms
- group.lights
- group.back_door_lock
- group.temperature_control
back_door_lock:
  view: no
  entities: 
    -entity list
temperature_control
  view : no
  entities:  
   - entity list

SOLVED!
Thanks for the suggestion and timely response.
Who ever owns https://home-assistant.io/components/group/ should add this ordering characteristic.

What was the solution?

See treno above. Edit groups.yaml that determines order.

My GUI order does not follow the order the groups are defined in. I am defining the groups within the .yaml file directly instead of in groups.yaml. Would that make a difference?

the order from top to bottom that groups are defined is the order in which they will appear on the frontend. if you add these groups to a view (defined in the same section as other groups) the groups will appear on the front end in which the groups were defined, NOT the order you list them in the view definition.

Example:

groups:
  group_1:
    name: Group 1
    entities:
    - component.1
    - component.2
  group_3:
    name: Group 3
    entities:
    - component.1
    - component.2
  group_2:
    name: Group 2
    entities:
    - component.1
    - component.2
  view_1:
    name: View 1
    view: True
    entities:
    - group.group_2
    - group.group_1
    - group.group_3

this will display the groups on the frontend in a new view called “View 1” and the groups will display in the order of:

  • Group 1
  • Group 3
  • Group 2

This is also true for the order in which other components such as switches, lights, automations, etc are defined. It doesn’t matter the order you list them in the group or view definition, it only matters the order in which the component/entity was defined.

This has definitely changed in a recent release, as now this example seems to display:

  • Group 2
  • Group 1
  • Group 3

:thinking:

Agree this has also changed in a recent release when i went to 0.57 all my views changed. I normally order group/ front end order by changing the group order in customize.

As an example changing “group.front_door” [group id 57] and “group.upstairs_door” [group id 56] i would expect the position to swap on the front end but this does not happen.

Groups will be ordered based in the order they are defined in your groups. order is only used now when you don’t explicitly define the groups.

I agree that the ordering seems a bit strange. I’ve split the groups into several yaml-files and it seems impossible to tell which order the views will appear in. I suggest a new index-property in the group definition and that the groups/views will be ordered by that value.

Something like:

first_floor:
  view : yes
  index: 1
  entities: 

second_floor:
  view : yes
  index: 2
  entities:

what you are describing exists. You can manually assign the order property to the group in customize.

Example:

customize:
  group.group_1
    order: 3
  group.group_2
    order: 1
  group.group_3
    order: 2

This will make the groups appear in order of group 2, group 3, group 1.

However, if people read what I posted, the group and entity display order depends on the order in which they are defined not in the order they are listed in the view. Sure the documentation may be lacking but once you play around with the ordering you’ll understand what it does and how to work with it.

Groups will be displayed in the order they are listed.

Well I’ll be… I just checked my configuration and yes, 0.57+ changes this behavior. group entities appear in the order in which they are listed and not in the order they are defined. However, in the case of listing groups and components in a view, it depends on the order they were loaded/defined. I have a camera for local radar and two groups for weather information in a view. the are listed as camera, group1, and group2, but they appear on the frontend as group1, group2, camera.

I am also having issues i agree with the statement "Groups will be displayed in the order they are listed."

As an example this is a list of my “groups” that i was shown on a separate tab

  downstairs_tab:
  name: Downstairs
  view: yes
  icon: mdi:sofa
  entities:
    - group.front_door_motion_sensor
    - group.front_door_temperature
    - group.desk_lamps
    - group.front_door   
    - group.living_room
    - group.deans_desk
    - group.plug_sockets
    - group.front_door_input_select
    - group.living_room_input_select
    - group.deans_desk_select_scene
    - group.front_door_brightness
    - group.living_room_brightness
    - group.deans_desk_brightness

When i view the tab via my mobile phone, the order is listed as above which is fine.

What i want to be able to do is change the the order of the groupings on my front end when at my PC. Before the update i was doing this using.

  group.living_room_brightness:
  order: 21 
  group.deans_desk_brightness:
  order: 22

so device specific group ordering? Not sure you can do that. HA doesn’t know what device is looking at it, it only knows that someone is looking at it. You could possibly incorporate an input_boolean that would toggle views/ordering but you would have to remember to flip the switch on the frontend each time you change devices

hmmm it use to function fine before i am sure.

As an example the below is my downstairs tab with has its own view.

When visiting on my mobile the order is correct

name: Downstairs
view: yes
icon: mdi:sofa
entities:
- group.front_door_motion_sensor
- group.front_door_temperature
- group.desk_lamps
- group.front_door   
- group.living_room
- group.deans_desk
- group.plug_sockets
- group.front_door_input_select
- group.living_room_input_select
- group.deans_desk_select_scene
- group.front_door_brightness
- group.living_room_brightness
- group.deans_desk_brightness

But the view in the tab is misordered when on Windows

I used to use customize as below but changing order “11” to “12” for example the entities do not change place, i am sure in previous versions this was not an issue

group.front_door_motion_sensor:
  order: 11
group.front_door_temperature:
  order: 10
group.desk_lamps:
  order: 12 
group.front_door:
1 Like

Ah nice.

“the group and entity display order depends on the order in which they are defined”

For me this is problem because I’ve divided the groups.yaml into several files making order a bit difficult to grasp. Renaming the files in alphabetical order didn’t work…

Thank you for the update using customize to order the groups - this solved my problem!