Card order via template

Hey there,

I have room based presense realized by now.
My main dashboard shows a list of rooms (area cards).

I want to reorder the cards in template because it would be nice to have the room (area card) I am physically in on top of the list.
Is there any way to realize that?

And additional question: In some rooms (e.g. garage) I want the HA app to automatically switch to a specific dashboard. Any ideas of that?


If you’re using standard cards, I’m pretty sure the only way to order them is to put them in a vertical or horizontal stack, or in a grid (or in a combination of all three). Otherwise they will change order according to the size of the card - there’s a blog post about it here:

A Home-Approved Dashboard chapter 1: Drag-and-drop, Sections view, and a new grid system design! - Home Assistant.

There may be something custom in HACS which you can use.

Eventually you can use other trick, I’m using for ‘notification’ cards; made them conditional and hide. Then only these cards that are ‘worth to be seen’ are visible. In case of presence it might mean that only one of several cardss of this type will be shown. Not perfect, as all other room card will be hidden…
Personally I use this for my main dashboard and on top of 2 person cards and one automation toggle card have several conditional cards that shows:

  • garbage to be collected today
  • washing machine completed the job
  • iron did not switched off
  • garage door opened or car not present in garage
  • automover did not returned to base station within reasonable time
  • several crds per room showing switched on lights
  • devices with batteries requireing replacement

By proper reordering them in dashboard I always see the most important card at the top of page (as unlikely several of the are active at the same time.

Building on concept above; for lets say 4 rooms, you can build 2 sets of 4 conditional cards, one set for all 4 rooms being visible when the room is occupied and second set of 4 cards, visible when the room is NOT occupied. Then you order them on dashboard so that cards visible when room is occupied are placed ‘higher’ on dasboard.
When room is occupied the corresponding card with top position is enabled (so visible on top of dashboard) and same card with lower position desabled (so not duplicated). Obviously how good this would work depends on concurrent presence in few rooms (more than one person), but this will always be a problem of prioritization.

Thanks mirekmal.

That is how I did it now.
Further I use the {{user}} in that templates to get the room of the current user who watches at the dashboard right now.

1 Like