I never used the aggregation feature of a group, until most recently when I grouped my three inverters and tried the ‘sum’ function.
It showed me the total solar PV production; how good it that!
I thought I could save the effort of creating an item for the total_pv_power, which is updated by a rule, which adds up the power of all three inverters. These items are persisted.
Thinking further, I thought why not persist the group and do away with the total_pv_power item and the related rule. But… I can’t persist a group.
Is it correct to conclude, that
a) I can’t persist a group’s aggregate function result
b) if I want to add up similar things, I need a rule to do that
c) however, if I only want to show the aggregate value (e.g., in a sitemap), and do not need persistence, I can use the group’s state for this
I can’t answer your question about persisting groups, but would guess that they are excluded since groups will immediately update when member items are restored from persistence.
Rather than using a rule to calculate the group, you could use a rule to update an item whenever the group’s state changes, and persist that item.
a) Incorrect. You can save the state of a Group. But you have to explicitly add that Group to the persistence config.
b) No, Group aggregation is an excellent easy to do that.
c) Groups with aggregation functions are great for either.
If you have a managed persistence config, just add a configuration (Settings → Persistence → Database) and choose the Group or Groups under “select items to be persisted”.
If you use. persist files, add a new line in the “Items” section listing your Group(s) by name followered by the strategies.
MyGroup1, MyGroup2 : strategy = everyChange
Notice that there is no “*” after the Group name. Omitting that causes persistence to treat that as a regular Item with a state instead of persisting all the members of the Group.