[SOLVED] Reordering Items in sitemap

I have a bunch of power meters in my sitemap and was wondering if there was a way to show them in a specific order based on their values - you could then see the most power consuming items at the top.

Is this possible?

Interesting question. I would like to have the same thing for my DateTime-Items.

You could create a set of dummy items, and periodically sort the values from real items into them.
Sounds like a job for a group-based rule

I have a group already which sums the total power consumption but go on sounds interesting…

Well, I would imagine you create a set of dummy Items and display in a fixed order in the site map. Strings perhaps, so you can include both a name and value.

A rule triggers on group change, but I’m not sure how you implement a sort. Iterating through groups is easy enough. Perhaps copy values into a working map (array) for a sort process, then copy to the displayable items.

Someone with more rule writing skills will come along I expect!

if you’ve only three or four meters, couldn’t you use a series of dynamic sitemap entries and the visibility parameter?

MyPowerItems.members.sortBy[state as Number]

That should work to sort from lowest to highest.

OK I found some similar work done by @Dibbler42 on another thread: Using .rules-variable as item label?

With @Dibbler42 help I have a working solution here: