sumSince and rrd4j


I already read a lot about the rrd4j persistence and it is also clear to me that the service does “compress” the data…the older the less accurate.

Therefore I played the last days with these settings here:


This should persist the data per minute for approx. 1 month (31 days)

At the end I would like to have a sum of kWh over last month. The persisted data is kWh per day and looks like this:

So…a fundamental question: Is it even possible to get the sum out of that graph with something like that:

var Number temp = PHouseDay.sumSince(now.minusMonth(1))

Thanks & BR

No. The only way this would work would be to only sum the value at midnight just before it resets to zero. You could do this in a Rule.

    Item DailyKWH changed
    if(DailyKWH.state == 0) {
        // code to deal with change of the month
        MonthlyKWH.postUpdate(MonthlyKWH.state + previousState)

How is this item updated in the first place. I would think that those daily values are summed up already, can’t you use the same technique for a month

Thanks @rlkoshak @opus

Yes, the daily values are already summed up:

var Number nHausTag = (PV_Tag.state as DecimalType) - (D0_Abgabe_Tag.state as DecimalType) - (LG_Resus_Charge_Day.state as DecimalType) 
								  + (D0_Bezug_Tag.state as DecimalType) + (LG_Resus_Discharge_Day.state as DecimalType) // Hausverbrauch Tag

It is possible to get all these items per month as well…was just thinking/trying to do something in the most effiicient and easiest way. And for sure to learn :slight_smile: But I already expected that my first idea does not work. So I will follow the way to have the value for every item per month and then do the calculations.