Charting item aggregate value or Sum by day

Is it possible to chart by an aggregate value .
eg If I write hourly can I sum for a daily chart?

There are not a lot of details to go on here, but in general create a separate Item to store the daily sum. At midnight (or there about) trigger a rule to calculate the daily total and update the daily sum Item.

Clarification, I’m persisting a item every hour, however I’d like to chart by day but sum the values.
ie I’m logging kwh every hour and would like see daily totals over the month.

Same answer. If you want to chart by day, you gotta save the data by day in a different Item (or change your existing Item to only save once per day).

I don’t think it can be that simple unfortunately.
I was just thinking about a similar issue to count the number of lightning per N hours.
You cannot just reset a counter every N hours since the latest records may not be N hours old.
So in theory, you would need to store timestamp + occurence or count and regularly delete the records that are too old.

For those, I am wondering if the best option is not to:

  • use persistence to persist the events (lightning, whatever, …)
  • run a query to the persistance DB to get the values

That’s exactly what I’m sugesting be done.

The “calculate the daily total” part is going to be something like items.MyItem.persistence.sumSince(time.toZDT('P-1DT')); (JS Scripting).