Group function used in sitemap to evaluate "number of number" resp. percentage result


currently I’ve in an .items file

Group:Number:COUNT(OFF) gNetstatShelly25 "Shelly 2.5 Offline [%d]" <network>

and in the corresponding .sitemap file

Text item=gNetstatShelly25 icon=rollershutter valuecolor=[0="green", >0="maroon"]

As expected the sitemap shows the number Shellys which are currently offline.


  • Is there a possibility to get an one entry in the sitemap, that shows the something like “Number/Total” e.g. 9/10 OR like a percentage value, e.g. 90%

Of course, it is possible to define two groups with functions, e.g. one to count the online items and one to count the offline items. But in that case, I would have two entries in the sitemap, too AND in fact two groups to be used in the items. Therefore: Is there an elegant way to only use one group (with function) and as a result with one entry in the sitemap?

Thank you for any hints!

You already know how many Items are in the Group. So your best bet is to hard code that into the label.

"Shelly 2.5 Offline [%d of 10]"

You can’t mix Items into the same entry on a sitemap and the only thing you have access to is the state of the Item, not how many members are in the Group. In fact, the sitemap doesn’t even know nor does it care that it even is a Group. It just sees an Item with a state.

If you want a percentage you can use a JavaScript transformation. But again, you’ll have to hard code the total number of members into the calculation.

Your alternative would be an additional free-standing Item, maybe a String type. Have a rule that listens for Group changes and populates the Item with whatever you fancy.

1 Like

Hard coding is usually not my favorite - but, you’re right, for this case it would be the easiest solution. Moreover, this would probably only affect the .items file, which must be adapted in anycase (e.g. register a new item and increase the number manually).

Yeah, also a good idea. Sounds like a virtual item which would be updated by rules after changes of the other groups.

Thank you both for the ideas!!

I’m going to use the hard coded version and try additionally the second option.