lovelace-auto-entities icon indicating copy to clipboard operation
lovelace-auto-entities copied to clipboard

Feature request: Improve sorting

Open zyp opened this issue 5 years ago • 7 comments
trafficstars

Hi, this is a double feature request, as there's two improvements to sorting I would like to see:

Firstly I would like to be able to sort by area.

Secondly I would like to be able to provide a list of sorting methods, so that entities that compares equally with the first method are sorted by the second method, and so on.

Combined, this will let me have entities appear room by room with each room sorted alphabetically.

zyp avatar Nov 26 '19 15:11 zyp

In all honesty - do you remodel your house often enough to justify a dynamically updating list of rooms?

thomasloven avatar Jan 08 '20 13:01 thomasloven

I'm not sure what point you're trying to make. I haven't asked for a list of rooms, I've asked for a list of entities sorted by which room they are assigned to.

zyp avatar Jan 08 '20 13:01 zyp

What I mean is that the easiest way to do this would be to specify one area at a time:

filter:
  include:
    - area: bedroom
      sort:
        method: name
    - area: kitchen
      sort:
        method: name
    - area: livingroom
      sort:
        method: name

and that you wouldn't have to change that list very often.

This has the added benefit that you can add section or divider rows in between the areas.

thomasloven avatar Jan 08 '20 15:01 thomasloven

I had this typed up as a new issue then github suggested it's actually already been created, so here's what I originally typed:


Subject: [Request] Secondary Sorting

@thomasloven this is soooooo amazing. you're probably sick of hearing that. (if not sick yet: sooooo super amazing! thank you!) great work!

I know very little about programming, so when I looked at the code in the repo pertaining to sorting, I was dumbfounded... would it be trivial to add secondary sort as an option?

Here's why: I have my sorting of window sensors based on open/closed status (open on top!) to more quickly draw the eye to what's open. That part works great, but the rest of the sensors are sorted in a pattern I haven't yet discerned (randomly??).

image

jschwalbe avatar Mar 08 '20 17:03 jschwalbe

IMHO the issue can be closed since both requirements are implemented, am I right?

ildar170975 avatar Feb 20 '22 08:02 ildar170975

Not quite. Even if the original request to be able to sort by area and something else doesn't make sense for most people who are not chronic home remodellers, there are more legitimate use cases, so I'm keeping this open in case inspiration strikes and I come up with a good way to solve this reliably.

thomasloven avatar Mar 11 '22 21:03 thomasloven

I'm not a chronic rodeler but always find my list of areas that are automated forever expanding. So if I implemented something like what you show with filters above, I'd have to update this whenever I make a new area, and then replicate that to all of my dozen or so auto-entities cards. Right now I don't filter so all of those devices change the sort order and this feature would help put some structure around that.

A question from me is could you implent a nested sort that would go by area first and then allow you choose a sub sort (alphabetic, last_changed, etc)?

poldim avatar Jul 30 '22 04:07 poldim